String length during editing

D

Dave Reardon

I have a memo field in a form into which users type. There is an integer
field which records the number of characters used. What I would like to do is
to get this to be updated during the typing. My attempts so far have been to
set it before update and then count key presses to increment a different
control, and add the two together. However, the problem is that a backspace
delete counts as a key press. Is there an easy way to get it to count the
characters typed in conjunction with the current length in a session please?

Dave
 
D

Dirk Goldgar

Dave Reardon said:
I have a memo field in a form into which users type. There is an integer
field which records the number of characters used. What I would like to do
is
to get this to be updated during the typing. My attempts so far have been
to
set it before update and then count key presses to increment a different
control, and add the two together. However, the problem is that a
backspace
delete counts as a key press. Is there an easy way to get it to count the
characters typed in conjunction with the current length in a session
please?


If you really want to do this, you can use the text box's Change event, and
in it, get the length of the control's Text proeprty. For example,

'----- start of example code -----
Private Sub txtMyTextbox_Change()

Me.txtCharCount = Len(Me.txtMyTextbox.Text)

End Sub
'----- end of example code -----
 
D

Dave Reardon

Dirk Goldgar said:
If you really want to do this, you can use the text box's Change event, and
in it, get the length of the control's Text proeprty. For example,

'----- start of example code -----
Private Sub txtMyTextbox_Change()

Me.txtCharCount = Len(Me.txtMyTextbox.Text)

End Sub
'----- end of example code -----

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
Thanks Dirk

It did exactly what it said on the tin!

Dave
 

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