Access2007,Set up a validation rule for storing 2 hex digits

G

Guest

I am trying to set up a validation rule for storing 2 Hex digits in a text
field. I am using the input mask >&& and the rule

(Between "A" and "F") and (Between "0" and "9")

However this does not work, any sugestions ?
 
A

Allen Browne

If you are not worried about case-sensitivity, you could use:
Is Null OR Not Like "*[!((A-F) or (0-9))]*"

Would it be easier to use an Integer field? That's 2 hex digits, and you
could display it that way with Hex().
 
G

Guest

Thanks for the sugestions,

I am setting up a db to store my customes settings such as IP addresses etc.
So the purpose is to store IP6 addresses to future proof the customers
record. I thought it would be better to store 6 fields of 2 digits rather
than 1 if 12 digits. This will help the user entering the data as each pair
is validated as they are typed rather than having to retype a long string.

Chard



Jamie Collins said:
I am trying to set up a validation rule for storing 2 Hex digits in a text
field.

Always two?

LIKE '[0-9A-F][0-9A-F]'

Jamie.
 
G

Guest

Allen,

This works well - Thanks.
I am not worried about case sensitivity since the input mask >&& forces the
chars to ucase anyway.

Chard

Allen Browne said:
If you are not worried about case-sensitivity, you could use:
Is Null OR Not Like "*[!((A-F) or (0-9))]*"

Would it be easier to use an Integer field? That's 2 hex digits, and you
could display it that way with Hex().

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Chard said:
I am trying to set up a validation rule for storing 2 Hex digits in a text
field. I am using the input mask >&& and the rule

(Between "A" and "F") and (Between "0" and "9")

However this does not work, any sugestions ?
 

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