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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

limit characters entered in form field? 1

Status
Not open for further replies.

simon551

IS-IT--Management
May 4, 2005
249
Hi all,
Do you know a way to limit the number of characters that can be entered in a text field?
Thanks,
-s
 
How are ya simon551 . . .

Here's an example using the [blue]KeyDown[/blue] event of the control ... [blue]you[/blue] substitute proper names in [purple]purple[/purple]:
Code:
[blue]   If Len(Me![purple][B][I]YourTextboxName[/I][/B][/purple].Text) = 5 Then
      MsgBox "Character Limit of 5 has been reached!", _
             vbInformation + vbOKOnly, _
             "Charactrer Limit Reached!"
      KeyCode = 0 [green]'null the key![/green]
   End If[/blue]
[blue]Your Thoughts? . . .[/blue]

See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top