Access Input Mask for phone number

  • Thread starter Thread starter Bruce
  • Start date Start date
B

Bruce

What is a phone number input mask that would result in the first case
916.723.5828 and second case if 916 is not entered 723.5828 notice the first
"." is left off.
 
Bruce said:
What is a phone number input mask that would result in the first case
916.723.5828 and second case if 916 is not entered 723.5828 notice the
first
"." is left off.
 
Bruce said:
What is a phone number input mask that would result in the first case
916.723.5828 and second case if 916 is not entered 723.5828 notice the
first
"." is left off.

This might work for formating the display:

Public Function FormatPhone(strIn As String) As Variant
On Error Resume Next

If InStr(1, strIn, "@") >= 1 Then
FormatPhone = strIn
Exit Function
End If

Select Case Len(strIn & vbNullString)
Case 0
FormatPhone = Null
Case 7
FormatPhone = Format(strIn, "@@@.@@@@")
Case 10
FormatPhone = Format(strIn, "@@@.@@@.@@@@")
Case Else
FormatPhone = strIn
End Select

End Function
 
Back
Top