|
-
January 28th, 2000, 03:29 PM
#1
How to validate a phone number
I have this code for checking to see if a phone
number is entered as numbers but it is not working
could someone tell me why?
If isempty(Phone) then
PhoneIsOkay = false
PageIsOkay = false
else
If len(Phone)<>8then
PhoneIsOkay = false
PageIsOkay = false
i = 1
While i < 8 'there are eight spaces that you want to check
Select Case i
Case 1,2,3 ' the positions in the string that should be numbers
If Not IsNumeric(mid(Phone,i,1)) then 'Check the format
PageIsOkay = false
End If
Case 4 'check that middle for a dash
If IsNumberic(mid(Phone, i, 1)) then
PageIsOkay =false
End If
Case 5,6,7 ' the positions in the string that should be numbers
If Not IsNumeric(mid(Phone,i,1)) then 'Check the format
PageIsOkay = false
End If
End Select
i= i+1
Wend
End If
End If
Thanks
Louise
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|