Data Validation Text Box

joeserrone

The cat of the cul-de-sac
Local time
Today, 09:22
Joined
Dec 17, 2006
Messages
164
Hello,
I have a simple text box and I would like to restrict a user to key in something with an A followed by 6 digits. Similar to this A555555 so that if the user keys in 555555 or P555555 it will receive an error message. Not sure if I should do this in VBA after the update even?
 
Howzit

Have a search in the access help for input mask. This will give you some ideas.
 
you could also use the before update event of the text box.
 
You can try to use a Validation Rule in your Text box Properties.

Take a look here..

http://www.everythingaccess.com/tutorials.asp?ID=Validation-Rules

May be a way to combine a couple of the examples to do what you want.

Like "*[!a-z]*" Only characters A-Z
Like "*[!0-9]*" Only Numbers 0-9
Like "????????" Eight Characters

Not sure how to combine them. But its worth a shot.

Perhaps Like "A??????"
 
Use Input Mask: \A000000
Letter A is constant and will appear when the first digit of the Number is keyed. Is 0s are used for numeric Mask all 6 digits are mandatory and will display Error if entered less value and attempts to leave out of the field. If 9s are used then accepts digits or Space.

If the first character can be A-Z then use L in place of \A.
 

Users who are viewing this thread

Back
Top Bottom