String length during editing

  • Thread starter Thread starter Dave Reardon
  • Start date Start date
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
 
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 -----
 
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
 
Back
Top