No of chars in a text field

J

John

Hi

I am trying to display the no of characters in a text field while user is
typing them. I am using the onchange event as follows;

Private Sub mytextfield_Change()
Me.chars = Str(Len(Me.mytextfield)) & " Characters"
End Sub

However it does not work as the field is actually not committed at this
stage. Is there a way to do this?

Thanks

Regards
 
D

Dirk Goldgar

John said:
Hi

I am trying to display the no of characters in a text field while
user is typing them. I am using the onchange event as follows;

Private Sub mytextfield_Change()
Me.chars = Str(Len(Me.mytextfield)) & " Characters"
End Sub

However it does not work as the field is actually not committed at
this stage. Is there a way to do this?

Without actually testing, I'd guess that your code would work if you
modified it to check the text box's Text property, instead of its Value
property:

Me.chars = Str(Len(Me.mytextfield.Text)) & " Characters"
 

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

Top