View Full Version : Simple Validation Question


mjmartin
07-29-2004, 09:01 AM
Hi, this is my first time posting and I have a really stupid easy question, how do I build an expression which allows letters, numbers and an underscore? Much like (in PHP):

$regex =
'^'.
'[_a-z0-9-]+'. /* One or more underscore, alphanumeric,
or hyphen charactures. */
'(\.\'[_a-z0-9-]+)*'. /* Followed by zero or more sets consisting
of a period and one or more underscore,
alphanumeric, or hyphen charactures. */
'$';

I'm putting this in the Table design window under 'Validation Rule'.

Any ideas? Thanks very much.

Len Boorman
07-29-2004, 11:12 AM
Think you want Input Mask

Validation checks what has been put in. Input Mask controls the input.

Check the Help

Len B

The_Doc_Man
07-29-2004, 11:14 AM
Access will want none of this. It ain't PHP. It is based on VBA/VB for its string and naming paradigms.

Access does not have callable syntactic/semantic parser routines built in to use regular expression definitions. And if you 'roll your own' such routines, I'm pretty sure the design views won't accept them as criteria.

So I'm afraid I'm the bearer of sad tidings. (I'm willing to admit that a newer version of Access might have something like this - but I haven't seen it as recently as Access for XP.)

mjmartin
07-29-2004, 12:44 PM
Sorry, I wasn't clear enough in the last post. All I want to do is only allow alphanumeric characters in this field.

EDIT: I just reread this and it looks a little rude, I assure you all it was not the intention, I've added a comma after the 'sorry', should read better now.