Character Len Count

  • Thread starter Thread starter The Report Guy
  • Start date Start date
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
 
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
 
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)
 
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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top