E
Elaine
Hi,
I have a textbox (txtPhone) that I want to have the end user enter the phone
number into. What I want to do is have the 10 numbers display back to the
user like: ###-###-#### or (###) ###-#### or ###.###.#### (which I can do,
no problem) ... My problem is, if the user goes back to modify the number on
the form before they hit "continue" I can NOT get the 10 numbers to be
stored again by themselves. If I do myphone = Val(txt.Phone.value) myphone =
"0" ... how do I get the txtPhone.Value to be stored as ########## and
display as something else (similar to a mask).
Here is my code:
If Not IsNumeric(txtPhone.Text) Then
If txtPhone.Text = "" Then
Exit Sub
Else
MsgBox ("Please type numbers only")
txtPhone.Text = ""
cancel = True
End If
ElseIf txtPhone.Text = "" Then
'txtPhone = "###-###-####" Then
txtPhone.Text = ""
ElseIf txtPhone.TextLength <> 10 Then
MsgBox ("Phone Numbers should be 10 digits")
cancel = True
Else
txtPhone.Text = Right(Format(txtPhone.Text, "(###) ### ####"), 15)
End If
Thanks,
Elaine
I have a textbox (txtPhone) that I want to have the end user enter the phone
number into. What I want to do is have the 10 numbers display back to the
user like: ###-###-#### or (###) ###-#### or ###.###.#### (which I can do,
no problem) ... My problem is, if the user goes back to modify the number on
the form before they hit "continue" I can NOT get the 10 numbers to be
stored again by themselves. If I do myphone = Val(txt.Phone.value) myphone =
"0" ... how do I get the txtPhone.Value to be stored as ########## and
display as something else (similar to a mask).
Here is my code:
If Not IsNumeric(txtPhone.Text) Then
If txtPhone.Text = "" Then
Exit Sub
Else
MsgBox ("Please type numbers only")
txtPhone.Text = ""
cancel = True
End If
ElseIf txtPhone.Text = "" Then
'txtPhone = "###-###-####" Then
txtPhone.Text = ""
ElseIf txtPhone.TextLength <> 10 Then
MsgBox ("Phone Numbers should be 10 digits")
cancel = True
Else
txtPhone.Text = Right(Format(txtPhone.Text, "(###) ### ####"), 15)
End If
Thanks,
Elaine