Thanks,
John Carroll
Hello John
I believe that you can achieve what you're after with an after update
event on a field. Say you have a field on your form called [Country]
and a field called [PhoneNumber], you could do the following:
Select Case [Country]
Case "Autralia","New Zealand"
Forms![Form1]![PhoneNumber].InputMask = "(###) ###-####"
Case "USA","England"
Forms![Form1]![PhoneNumber].InputMask = "(##) ###-####"
End Select
This would change the input mask for the field [PhoneNumber] on the
fly after you select a different country in the [Country] field.
I've never tried this but I think it should work
Regards
Trevor
Trevor Hughes - ba...@southern.co.nz
> John Carroll <jcar...@electro.com> wrote:
>
> >Is there a way to design a special input mask for international
> >telephone numbers? Depending on the Country, you can have a 2 or 3 digit
> >Country code, then a 1 to 3 digit Routing code before you get to the
> >main number which is not always 7 digits. I would also like to change
> >input masks on the fly if you are entering a new Company. I'm sure this
> >could be done with code.
> >Any suggestions?
>
> I believe that you can achieve what you're after with an after update
> event on a field. Say you have a field on your form called [Country]
> and a field called [PhoneNumber], you could do the following:
>
> Select Case [Country]
> Case "Autralia","New Zealand"
> Forms![Form1]![PhoneNumber].InputMask = "(###) ###-####"
> Case "USA","England"
> Forms![Form1]![PhoneNumber].InputMask = "(##) ###-####"
> End Select
>
> This would change the input mask for the field [PhoneNumber] on the
> fly after you select a different country in the [Country] field.
>
Of course, given the way Oftel likes to change our phone numbers around
every six months or so, you might like to extend this to make it more
maintainable :-)
How about a table with the fields Country, CountryCode and InputMask.
When the user picks the country, the country code could be picked up
automatically and the input mask set from the linked table (it's just a
string after all). Then when the format changes, you can change the input
mask in the table, not have to go poking through a monster case statement
looking for the entry for Outer Mongolia.
(BTW, Uk phone numbers are so irregular - they can be from 4 digits to 7
and the area codes are frequently longer than the numbers - that designing
an input mask would be quite a challenge, but never mind)
Sally
* email: S.Hinc...@rbgkew.org.uk *
* The Royal Botanic Gardens, Kew, Tel : +44 (0)181 332 5735 *
* Richmond, Surrey, TW9 3AB, UK Fax : +44 (0)181 332 5197 *
>On Tue, 4 Feb 1997, Trevor Hughes wrote:
>
>> John Carroll <jcar...@electro.com> wrote:
>>
>> Select Case [Country]
>> Case "Autralia","New Zealand"
>> Forms![Form1]![PhoneNumber].InputMask = "(###) ###-####"
>> Case "USA","England"
>> Forms![Form1]![PhoneNumber].InputMask = "(##) ###-####"
>> End Select
>>
Hi,
I hate to tell you this *but* here in Oz we are converting our phone numbers
to 8 digits (###) ####-#### - so you might want to adjust your fields. Not all
states have been converted yet - sorry I can't remember the schedule for full
change-over.
Have fun
----
Regards