robman70
Technical User
- Aug 6, 2002
- 90
maybe someone can help me, i have a text field that a phone number is entered into, after the phone number is entered it is formatted to look like 713 555-1212, after that i want to format it to remove the spaces and the dash, the code below removes the space but deletes the dash and everything after, so the number ends up 713555 and no 1212, is there a better way to do this or something im missing?
Private Sub cmdSolect_Click()
Dim intPhoneField
If txtCustPhone.Text = "" Then
MsgBox "Phone number field is blank ", vbCritical, "Scratchy Pad"
txtCustPhone.SetFocus
Exit Sub
End If
intPhoneField = Val(txtCustPhone.Text)
intPhoneField = Replace(intPhoneField, "-", ""
'intPhoneField = Replace(intPhoneField, " ", ""
txtCustPhone.Text = intPhoneField
End Sub
thanks for any help
Private Sub cmdSolect_Click()
Dim intPhoneField
If txtCustPhone.Text = "" Then
MsgBox "Phone number field is blank ", vbCritical, "Scratchy Pad"
txtCustPhone.SetFocus
Exit Sub
End If
intPhoneField = Val(txtCustPhone.Text)
intPhoneField = Replace(intPhoneField, "-", ""
'intPhoneField = Replace(intPhoneField, " ", ""
txtCustPhone.Text = intPhoneField
End Sub
thanks for any help