Validation Rules???

E

ERROR!

Hello,

I am creating a database of names and telephone numbers etc. for my work and
I can't seem to get one of my Validation rules to work. I am basically trying
to make the database so that it is fool-proof. So in doing this I am trying
to create a validation rule that prevents the user from typing in anything
other than a mobile phone number. But at a guess my rule doesn't let the
number begin with 0 because to it, it is not a number.

I have the settings set to Long Integer, with 0 decimal points allowed.
The rule I have been trying to use is...

Like "0?????????" Or Is Null

Do you know how I can create a validation rule that prevents anything else
from being typed in??? If you can please oh please let me know! I appreciate
it more than I can say! Thank-you very much (in advance)!

P.S. If you have any other suggestions as how I can make my database
"fool-proof" please also let me know, I will be checking back regularly so
feel free to leave an idea. Oh and one other thing if I want the validation
rule to write something if the data thats meant to be written in there is not
available, how do i go about doing that.

P.P.S I am using Access 97

P.P.S.S. - I want to make it look impressive so any fancy ideas are
appreciated too!

But I cannot seem to get it to work.
 
J

John Vinson

Hello,

I am creating a database of names and telephone numbers etc. for my work and
I can't seem to get one of my Validation rules to work. I am basically trying
to make the database so that it is fool-proof. So in doing this I am trying
to create a validation rule that prevents the user from typing in anything
other than a mobile phone number. But at a guess my rule doesn't let the
number begin with 0 because to it, it is not a number.

The number 12 and the number 000012 and the number 012 are THE SAME
NUMBER.

You'll never do any arithmatic with a phone "number"; and an
international number could exceed the 2 billion odd size of a long
integer anyway.

Phone numbers should be stored in a Text field, not any sort of number
field; you can use an Input Mask and validation rules to do what you
request.


John W. Vinson[MVP]
 
J

John Nurick

Hi Error,

Don't try to store a telephone number in a numeric field. These don't
store numbers as strings of digits but as binary-coded numeric values,
so there's no difference between 012 and 12. In general, if you have
something that's called a "number" but you can't do arithmetic with it,
treat it as a string of digits and store it in a text field.

After that, it's a question of knowing or working out the rules for
distinguishing mobile phone numbers from others. These vary greatly from
country to country. Where I am, they begin with 77, 78 or 78, e.g.
07712 345678
+44 (7712) 345678
but I believe that in some countries there is no simple rule.

If you don't mind rejecting international numbers you can limit entries
to ones like the first example above by using a validation rule like
Like "07[789]## ######" Or Is Null

If you need more flexibility, add more elements to the validation rule -
or use the regular expression validation procedure at
http://www.mvps.org/access/modules/mdl0063.htm
 
J

John Vinson

After that, it's a question of knowing or working out the rules for
distinguishing mobile phone numbers from others. These vary greatly from
country to country. Where I am, they begin with 77, 78 or 78, e.g.
07712 345678
+44 (7712) 345678
but I believe that in some countries there is no simple rule.

There is no distinction between mobile and line phones in the US, to
my knowledge. The format is exactly the same; my home phone and my
cellphone both have the format (208)xxx-xxxx.

I'm sure there are some prefixes reserved for cell, but they'd differ
from one exchange or area code to the next.

John W. Vinson[MVP]
 
E

ERROR!!

Hello to my wonderful helpers!

Just wanted to let you know that the problem I encountered has been fixed
and I am very much appreciative of your guidence in the matter.
So thank-you very, very much! I will definantly be coming back here if I have
any other issues because there is a wealth of knowledge and alot of
fantastic people
who are willing to share it! Thanks again!

Kind regards
Error...no more (aka. Andrea)
 

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