|
|
Is there a way to modify the Phone Number Input mask from the Input Mask Wizard to allow the user to enter an extension number at the end of the usual 10 digit phone number? I find it much more convenient to enter the extension in the phone number field rather than create separate field for extensions.
The default Phone Number Input mask is the following string:
!\(999") "000/-0000;;_
When you enter 10 digits in the form field, you get something that's formatted like this:
(555) 123-4567
That mask won't let you enter more than 10 numbers.
I would like to be able to enter up to five characters of my choice, preferable preceded by a space character. In other words, after the number above, I'd like to be able to type an "x", followed by up to four numbers as shown below:
(555) 123-4567 x1234
where the input mask automatically inserts a space before the "x."
Any suggestions on how to modify the input mask above to accomplish this?
Thanks in advance,
Paul
|
|
"Paul" <begone[ at ]spam.com> wrote:
[Quoted Text] >Is there a way to modify the Phone Number Input mask from the Input Mask >Wizard to allow the user to enter an extension number at the end of the >usual 10 digit phone number?
Don't use the input masks. And while you're at it who cares about the ( and ). I just have spaces between my phone numbers. Others have dots or dashes. And the ( ) would take long for users to enter than ..dots or dashes. Spaces would take very little extra time.
You could remove the input mask and use an update query to insert the separator of your choice.
BTW by using input masks you also assume that you'll never have numbers from outside Canada, USA, Mexico or the Caribbean, right? Bad assumption in my opinion.
Tony -- Tony Toews, Microsoft Access MVP Please respond only in the newsgroups so that others can read the entire thread of messages. Microsoft Access Links, Hints, Tips & Accounting Systems at http://www.granite.ab.ca/accsmstr.htm Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
|
|
Thanks for taking a few moments to reply, Tony. In a way I see what you're getting at, but I don't think the input mask is as useless as you think it is. For example,
The user doesn't have to enter the parenthesis, because the Input Mask does it for them. All they have to do is enter the numbers. (One limitation is that if they don't start in the right place, they have to use keystrokes or the mouse to position the cursor). But if they begin at the right spot, they only have to type the numbers. So the input mask even puts in the spaces.and thus fewer keystrokes are required than for someone that has to enter the dots, dashes and spaces themselves.
MS Outlook has a very nice way of handling phone numbers. If you type 10 digits without any other characters, it puts it into the common (555) 123-4567 format after you're finished, without getting in the way while you're entering numbers. But if you type something it doesn't recognize, like a European phone number, it seems to just leave it alone. So it let's you override the mask, which I think is good.
You mentioned I could run an update query, but I'm thinking it might be easier to put some VB code in the After Update event of the control that checks to see if the entry has either 7 or 10 characters. If so, it adds the appropriate formatting - otherwise it lets the user put in whatever he wants. So I'd probably try something like this:
If Len(strPhoneNum) = 7, then NewNum = Left(strPhoneNum,3) & "-" & Right(strPhoneNum,4) ElseIf Len(strPhoneNum) = 10, then [and here you use some combination of Left(), Mid(), InStr() or Right().] Else do nothing.
Do you think something like that would work in the After Update event?
Again, thanks for taking a look at this.
Paul
|
|
|