Verify Phone

S

Striker

Is there a method for verifying first if the data entered is a valid number,
then if it's a valid phone number? By Valid phone number I mean is it 10
digits without any formatting EXAMPLE ##########?

I think I can use IsNumeric for the first part, but can I pass a format to
IsNumeric, if so how?

Thank You
 
J

JK

Make the field a Text field and on the property sheet (of the form) set the
mask to 0000000000;1 this will force the user to enter 10 digits exactly -
i.e only 10 digits will be allowed, anything else will be rejected.

Regards/JK
 
R

RoyVidar

Striker said:
Is there a method for verifying first if the data entered is a valid
number, then if it's a valid phone number? By Valid phone number I
mean is it 10 digits without any formatting EXAMPLE ##########?

I think I can use IsNumeric for the first part, but can I pass a
format to IsNumeric, if so how?

Thank You

I'd be a bit careful with the IsNumeric function, because in some
positions, the letters D and E are interpreted as scientific
notation.

In the immediate pane (ctrl+g) try

s = "12345678E1"
? IsNumeric(s) ' returns True

Try using the like operator. If your number is stored in a string
variable called s, then

If s Like "##########" Then
MsgBox "10 digits"
Else
MsgBox "Nah..."
End If
 

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