Validating telephone numbers

  • Thread starter Thread starter rocky 123
  • Start date Start date
R

rocky 123

Hi there,

I want to validate a telephone number input field, but don't know wha
to use. Doing a length check allows erroneous such as letters to be i
the phone number. And doing a check of 'whole number' doesn't wor
either as different phone numbers have different lengths and most star
in zero.

Anybody got any ideas please?

Thanks,
rocky
 
One way:

This is a simplistic example - you'll want different possible valid
formats:

Public Function ValidPhone(sIn As String) As Boolean
ValidPhone = (sIn Like "(###) ###-####") Or _
(sIn Like "###-###-####")
End Function
 

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

Back
Top