Access Input Mask for phone number

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.
 
D

De Jager

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.
 
A

Arvin Meyer [MVP]

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
 

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

Top