Autoformat telephone number field based on number entered

  • Thread starter Thread starter Leoram
  • Start date Start date
L

Leoram

Guest
I have designed a form in Access 2000. I need my Telephone field in its subform to automatically change the phone number format entered based on the number entered from "0" to "9999999999", that is, according to the following criteria:

From # to: Format:
0-9 = Blank
10-9999 = #### (For any extension No.)
10000-999999 = Blank
1000000-9999999 = ###-####
10000000-99999999 = #-###-####
100000000-999999999 = Blank
1000000000-9999999999 = (###) ###-####

Any help will be appreciated.

Leoram
 
I have a similar situation based on whether it's a US address or a foreign address. This is what I've used to change the input mask depending on what country is selected in the countryid field.

Select Case Me.CountryID
Case 224, 39
Form_frmUwrContactsSubform.Phone.InputMask = "!(999)999-9999"
Form_frmUwrContactsSubform.Fax.InputMask = "!(999)999-9999"

Case Else
Form_frmUwrContactsSubform.Phone.InputMask = "!+999(999)999-9999"
Form_frmUwrContactsSubform.Fax.InputMask = "!+999(999)999-9999"

End Select

Hope this gives you some ideas.
 

Users who are viewing this thread

Back
Top Bottom