Link to home
Start Free TrialLog in
Avatar of jwjjwj
jwjjwj

asked on

Count the characters entered in an MSAccess field and report the remaining characters to another field

I would like to count the number of characters entered in a access field, using VBA.
The field I wish to count is called FDDATA and is a text field of 255 characters.
I wish to show the person inputing how may characters remain for input counting down from 255 and display this result in an unbound field called fldCounterRemaining
I would like to allow for deletions and backspaces to be taken into account.
Could some give me a working routine.
Thanks in advance
Avatar of DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
Flag of United States of America image

Enter text into  Text6 - display count in Text8

Private Sub Text6_Change()
    Me.Text8 = "Remaining: " & 250 - Len(Me.Text6.Text)
    DoEvents
End Sub

mx
use the LEN function to get the length
len(FDDATA)
ASKER CERTIFIED SOLUTION
Avatar of DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jwjjwj
jwjjwj

ASKER

Thank you very much.  Works like a dream