Validation

P

Phippsy

Setting validation for a code such as AB1234C where there are always 2
letter, 4 numbers and 1 letter. I thought ? represented a letter and # a
number but if I set Like "??####?" the ? will also take a number. Is there
any setting which will force the firt 2 and last to be letters only?
Thanks
 
P

Phippsy

I am only wanting to do this in the validation setting without getting
involved in input mask but yes that works thank you. Am I correct in saying
that in the validation a ? represents a letter or a number? Is there a way of
setting what I want simply in the validation?
 
D

Damian S

Yes, you are correct that ? represents any character (alphanumeric).

To tell you the truth, I don't often use the validation function, as a lot
of stuff that requires validating needs greater complexity and it's easier to
document when you do it in the code behind the scenes...

I would use an event procedure behind the After Update event.

Damian.
 
P

Phippsy

Thanks - I am actually training people at the ECDL level so this is what they
need but I see your point. Thanks
 
P

Phippsy

Thank you

Jamie Collins said:
Setting validation for a code such as AB1234C where there are always 2
letter, 4 numbers and 1 letter. I thought ? represented a letter and # a
number but if I set Like "??####?" the ? will also take a number. Is there
any setting which will force the firt 2 and last to be letters only?

The problem with the '?', '#' and '*' characters is they are
proprietary to Access/Jet and are not portable. Worse, they assume
ANSI-89 mode (e.g. DAO); your validation can be circumvented by
switching to ANSI-92 mode (e.g. ADO), although in this case it would
prevent changes.

Make your pattern matching ANSI mode neutral by using:

'[A-Z][A-Z][0-9][0-9][0-9][0-9][A-Z]'

Jamie.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top