Character Len Count

T

The Report Guy

Hi,

I comments txt field with a max character of 255. I like to have on my form
letting the user know the number of characters that the user has entered.

I try the Len([comments]) but that only works after they moved on to another
field. I need the field to instantly know the number of characters as they
type.

Any suggestions.

Thanks
 
D

Dale Fye

You can use the forms current event to initially compute the number of
characters remaining using the controls Value property, but once the control
has the focus, you will need to use the Text property to get the current
number of characters. Use the controls Change event and the Text property to
display the number of characters used or remaining. The text property is
only available while that control has the focus, so it is ideal for use in
the change event.

Something like:

Private Sub txt_SomeField_Change

me.lbl_SomeField_Length.Caption = 255 - len(me.txt_SomeField.Text) & "
characters remaining"

End Sub

HTH
Dale
 
F

fredg

Hi,

I comments txt field with a max character of 255. I like to have on my form
letting the user know the number of characters that the user has entered.

I try the Len([comments]) but that only works after they moved on to another
field. I need the field to instantly know the number of characters as they
type.

Any suggestions.

Thanks

Code the Comments Change event:
Me![ShowCountControl] = Len(Me![Comments].Text)
 
T

The Report Guy

Thanks guys... that helps

fredg said:
Hi,

I comments txt field with a max character of 255. I like to have on my form
letting the user know the number of characters that the user has entered.

I try the Len([comments]) but that only works after they moved on to another
field. I need the field to instantly know the number of characters as they
type.

Any suggestions.

Thanks

Code the Comments Change event:
Me![ShowCountControl] = Len(Me![Comments].Text)
 
Top