input mask for phone number

S

Steve2788

I am making an input mask for a phone number. sometimes i don't want to
include an area code. the information on help says:

Examples of input masks
The examples in the following table demonstrate some ways that you can use
input masks.

This input mask Provides this type of value Notes
(000) 000-0000 (206) 555-0199 In this case, you must must enter an area code
because that section of the mask (000, enclosed in parentheses) uses the 0
placeholder.
(999) 000-0000! (206) 555-0199
( ) 555-0199 In this case, the area code section uses the 9 placeholder, so
area codes are optional. Also, the exclamation point (!) causes the mask to
fill in from left to right.

However when i try it with or without the !, the field fills in from the
left. Unless I type [space],[space],[space], then the 7-digit number it will
not accept it.
 
J

Jerry Whittle

I don't use input masks for phone numbers or zip codes. Why? If you ever have
to do business with someone out of the USA or Canada, the phone number won't
fit. For zipcodes it's even worse as Canada, and the rest of the world, have
a much different postal code addressing system.

If it's causing you grief, you might consider just not doing an input mask.
 
G

Gina Whipp

Steve,

As Jerry says, input masks are not a good idea unless you plan on sticking
with the US only. If you are trying to 'force' consistent data entry you
might want to consider writing some validation code.

Untested...
If [ZipCode] = DLookUp("ZipCode",'TableWithUSZipCodes","ZipCode ='" &
Me![ZipCode] & "'") Then
Me.YourZipCodeField = Me.YourZipCodeField.InputMask = "00000-9999"
End If

Not an easy thing to do with phone numbers but perhaps you could 'force' an
input mask based on whether the zip is US or not.

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" - Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

Jerry Whittle said:
I don't use input masks for phone numbers or zip codes. Why? If you ever
have
to do business with someone out of the USA or Canada, the phone number
won't
fit. For zipcodes it's even worse as Canada, and the rest of the world,
have
a much different postal code addressing system.

If it's causing you grief, you might consider just not doing an input
mask.
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.

Steve2788 said:
I am making an input mask for a phone number. sometimes i don't want to
include an area code. the information on help says:

Examples of input masks
The examples in the following table demonstrate some ways that you can
use
input masks.

This input mask Provides this type of value Notes
(000) 000-0000 (206) 555-0199 In this case, you must must enter an area
code
because that section of the mask (000, enclosed in parentheses) uses the
0
placeholder.
(999) 000-0000! (206) 555-0199
( ) 555-0199 In this case, the area code section uses the 9 placeholder,
so
area codes are optional. Also, the exclamation point (!) causes the mask
to
fill in from left to right.

However when i try it with or without the !, the field fills in from the
left. Unless I type [space],[space],[space], then the 7-digit number it
will
not accept it.
 

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