Link to home
Start Free TrialLog in
Avatar of Sariff
Sariff

asked on

Restrict characters in Text Box

I have text boxes that restrict the characters that are entered. The code is below:

If Me.TextBoxName.Value Like "*[!A-Z]*" Then
        MsgBox
        Cancel = True
End If

I need it to allow hyphens also...

-Sariff
ASKER CERTIFIED SOLUTION
Avatar of rockiroads
rockiroads
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
SOLUTION
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 Sariff
Sariff

ASKER

Actually I am using the code in the 'Before Update" event. It works well. The hyphen part does not work...
Avatar of Sariff

ASKER

I found my answer. Thanks!