real time character count

G

Guest

I'm using Access 2003 and have a form that has both text and memo fields.
The text fields have character limitations. I've tried a couple of variants
that I've found on the subject (see below) , but I get a control not found
error on the "caption" control. There was insufficient informaiton in the
orginal post for mne to identify the source of the "lblLeftNotes.Caption"
control. Any assistance woud be approeciated.

My text field is CACRDesription with a limit of 1040 characters.

Dim Length As Integer
Length = 1040 - Len(CACRDescription.Text)
lblLeftNotes.Caption = "(" & Length & ")"

Thanks,
Dan
 
R

RuralGuy

I'm using Access 2003 and have a form that has both text and memo fields.
The text fields have character limitations. I've tried a couple of variants
that I've found on the subject (see below) , but I get a control not found
error on the "caption" control. There was insufficient informaiton in the
orginal post for mne to identify the source of the "lblLeftNotes.Caption"
control. Any assistance woud be approeciated.

My text field is CACRDesription with a limit of 1040 characters.

Dim Length As Integer
Length = 1040 - Len(CACRDescription.Text)
lblLeftNotes.Caption = "(" & Length & ")"

Thanks,
Dan

Try using the Me. scoping syntax:
Length = 1040 - Len(Me.CACRDescription.Text)
Me.lblLeftNotes.Caption = "(" & Length & ")"
_______________________________________________
hth - RuralGuy (RG for short)
Please post to the NewsGroup so all may benefit.
 
G

Guest

I managed a workaround by using the statusbartext control. For those
interested, the code I used is:

Dim Length As Integer
Length = 1040 - Len(Me.FieldA.Text)
Me.FieldA.StatusBarText = "(" & Length & " characters remaining)"

Note that in a text field 255 char is the max and the form will block
additional characters from being entered. On a memo field the limit is soft,
ie it will allow the user to continue entering data (the remainig characters
will reflect a negaive number)

Dan
 

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