domestic and intl phone number issue

D

deb

I am putting together a contacts form called f014Contacts.
The issue is about phone numbers. I need to allow domestic and international.
I would like to use an input mask for the domestic numbers and no mask for
international.

I have a option box Yes/No with yes as Domestic.

Is it possible to use the same field called ContactPhone and when the option
of Domestic is chosen then use the mask and if the option of International is
chosen then do not use the mask.

If this is not possible, Please give your suggestion on how to solve this
issue.

Thanks in advance,
 
A

aaron_kempf

well in SQL Server, it would be easy to keep these as completely
seperate fields.. and then use a simple ISNULL or COALESCE to combine
them back.

It would be quite easy to use a computed column to do this... It would
take me less time to do than it took me to write a single sentence.

-Aaron
 
B

BruceM

Ignore Aaron. He'll get bored and go away soon. He always does.
You can set the input mask property with VBA. In the yes/no check box After
Update event:
If chkDomestic = Yes Then
Me.txtPhone.InputMask = "\(999\)\ 000\-0000;0;_"
Else
Me.txtPhone.InputMask = ""
End If

You may want to consider some things before you do this. It calls for an
extra user step that could get annoying. If the user last entered a foreign
number, if the next number is domestic they will need to check the domestic
box before getting the input mask. More to the point, they may realize they
can just clear the box and avoid the input mask altogether. If you feel it
is best to try to force the use of an input mask it may be better to use the
After Update event of the control bound to the Country field. Of course,
the user who doesn't like the input mask may leave the country blank until
after the phone number is filled in. There are a lot of twists and turns on
the course you are trying to take. In any case, it is best to limit the
Country choices so that, for instance, the user has to choose Canada rather
than having the option to use Can., Can, or other variations. If Country is
blank or USA (or United States, or whatever you choose), use the input mask;
otherwise, don't. You will probably do best to store the literal values of
the parentheses, etc. (the 0 after the first semi-colon specifies this) so
that if the input mask is off the number displays correctly.
 
D

deb

BruceM
This worked perfectly for what I needed. Your additional information was
extreamly helpful. I appreciate you going the step beyond to cover all
bases!!

Thank You,
 
W

Wayne-I-M

Hi

Arron makes a valid point about keeping the fields seperate. If you combine
this with the points made by Bruce you will be able to come up with a user
friendly UI.

EG.
You could use an anbound combo to store the country and country codes
(visible from the afterupdate of a tckbox). Use this to select the country
and have (maybe) another afterupdae on this (to delete the preceeding 0's)
from the phone number.

It depends on how many counties you deal with but it would be possble to
define a number of input masks - relevant on the country code combo.

Just a thought
 

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