Only alphabets

T

Tausif

Hi all gurus,

I have user id field in a user table I want to restrict the field to accept
only Alphanumeric values without any space. How can I put this restriction
at db level? please guide. Thankx.

Tausif
 
D

Dirk Goldgar

Tausif said:
Hi all gurus,

I have user id field in a user table I want to restrict the field to
accept only Alphanumeric values without any space. How can I put this
restriction at db level? please guide. Thankx.

"No spaces" is easy: in the table's design view, create a Validation
Rule for the field, like this:

Not Like "* *"

You could also set the Validation Text property to

No spaces, please!

or such other message as you might like.

On the other hand, if what you really want is to restrict entry to only
alphabetic (A-Z) or numeric (0-9) characters, then you'd want a
validation rule like this:

Not Like "*[!a-z0-9]*"

Note that there is no distinction made between lower- and upper-case
letters.
 

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