By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,222 Members | 1,123 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,222 IT Pros & Developers. It's quick & easy.

No of chars in a text field

P: n/a
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
Nov 12 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
You can do it if you use the .Text property

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

"John" <Jo**@nospam.infovis.co.uk> wrote in message
news:3f**********************@news.dial.pipex.com. ..
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

Nov 12 '05 #2

P: n/a
"John" <Jo**@nospam.infovis.co.uk> wrote in message
news:3f**********************@news.dial.pipex.com. ..
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

Use Me.Mytextfield.Text

When you use Me.mytextfield you are in fact referring to the default
property me.mytextfield.value which is the last saved data for the control.
While the control is being edited you can use me.mytextfield.text which
contains the data currently in the control.

HTH
Fletcher
Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.