No of chars in a text field

  • Thread starter Thread starter John
  • Start date Start date
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
 
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"
 
Back
Top