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

Exclude spaces and symbols from text data type

Status
Not open for further replies.

jocat

Technical User
Dec 28, 2001
25
0
0
US
I am updating a database that contains license plate numbers. A common data entry error is to include spaces or dashes in the license plate number. I want to format the text field in the table so the clerk cannot enter spaces or symbols in the field.

The field size is 8 characters. When I tried an input mask of AAAAAAAA all eight characters must be entered (some license plate numbers have less than eight characters). When I use aaaaaaaa there is still a chance that a space can be accidentally entered.

How can I format the field so that only letters and numbers can be entered, and not all of eight characters have to be entered.

Any suggestions would be greatly appreciated.

Joe
 
You can add a validation rule:

[tt]Not Like "* *" And Not Like "*-*"[/tt]

However, you mention 'table': all data entry should be via forms. There are a number of reasons for this rule and one of them is control of data. With a form, you can fully validate the license plate in a suitable event, Before Update, for example.
 
Now why didn't I think of that?

I keep telling them that I am overworked.

All if my input is through forms. I just didn't mention the form in my request.

Thanks!

Joe
 
One more question.

How do I exclude the bracket [ and the asterisk * .

it is not recognized when I insert Not Like "*[*.

Joe
 
Have you tried this (as explained in the VBA help) ?
Not Like "*[[]*

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
That did it.

Thank you, thank you, thank you!

Joe
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top