Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I have a textbox on a form and want

Status
Not open for further replies.

illini

Technical User
Aug 2, 2002
89
FR
I have a textbox on a form and want to limit the data entered to 100 characters. What's the best approach to this? -illini
 
Hi

If it is a bound form, and the text box is bound to an underlying table, in the table definition, set the length to 100.

or if it is not a bound form, or you do not want an access system message then

Private Sub strDefault_BeforeUpdate(Cancel As Integer)
If Len(strDefault) > 100 Then
MsgBox "At 100 characters, exceeds max length allowed"
Cancel = True
End If
End Sub

Regards
Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
UK
kenneth.reaySPAMNOT@talk21.com
remove SPAMNOT to use
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top