Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 18th, 2004, 11:24 PM
bph bph is offline
Friend of Wrox
 
Join Date: Dec 2003
Posts: 102
Thanks: 2
Thanked 0 Times in 0 Posts
Default U.S versus International Phone Numbers

How do people deal with this seemingly common issue, considering our global economy, using only one textbox?

Can't format or input mask for both types of phone numbers.

Am I looking at invisible textboxes again?

Somehow reinventing the wheel doesn't seem necessary.

thx, bph
 
Old February 19th, 2004, 08:37 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

If a US and Canadian number has ten digits and other international phone numbers have more then store JUST the number in the table WITHOUT the formatting (it saves space, btw). However, on the form and reports' On Current events, format the textboxes on the fly to fit the number based on the country.

In other words, STORE just numbers but SHOW proper formats based on country.

Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
 
Old February 19th, 2004, 09:44 AM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 174
Thanks: 0
Thanked 0 Times in 0 Posts
Default

go to http://www.rogersaccesslibrary.com/OtherLibraries.asp and then click on Tejpal, A.D. He has a sample database called InputMask_Dynamic.mdb with the following description:
This sample db demonstrates dynamic setting of Input Masks at run time - with
partly pre-filled values as desired.
Three cases are covered -
        (a) Phone Numbers - with area codes pre-filled
        (b) Dates pre-filled with desired month and year part.
        (c) Text string prefixed/suffixed with current month-year.
The sample is in Access 2000 file format developed on Access XP installation.

HTH,

Beth M
 
Old February 19th, 2004, 03:05 PM
bph bph is offline
Friend of Wrox
 
Join Date: Dec 2003
Posts: 102
Thanks: 2
Thanked 0 Times in 0 Posts
Default

Thanks to you both. Plenty of good info to work with.

 
Old February 19th, 2004, 05:00 PM
bph bph is offline
Friend of Wrox
 
Join Date: Dec 2003
Posts: 102
Thanks: 2
Thanked 0 Times in 0 Posts
Default

Okay, so I thought I had come up with a simple way to solve this issue. And I think I'm on the right track.
I created a unbound checkbox called chk_USA on the form next to the phone number text box.
In the ONCURRENT Event if have the ollowing code.

If Me.Chk_USA.Value = True Then
Me.txtContactPerson_Phone_Number_1.InputMask = "999\-000\-0000;0;_"
Else: Me.txtContactPerson_Phone_Number_1.InputMask = "#########################"

My theory is that if the box is checked then "999\....format for entry in the txtbox. Else enter whatever the foreign number is. Somehow the code doesn't pick up the checked box and give me the "999\...format. Always get the else format__________________ ? What am I missing -- thx, bph
 
Old February 19th, 2004, 05:03 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

Change that to just

If Me.Chk_USA Then

Because Me.Chk_USA is a checkbox that holds a boolean value (True/False), you don't need to quantify it for the IF statement.


Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
 
Old February 19th, 2004, 05:15 PM
bph bph is offline
Friend of Wrox
 
Join Date: Dec 2003
Posts: 102
Thanks: 2
Thanked 0 Times in 0 Posts
Default

I put the code in the control on the form and it's working.

This format {InputMask = "999\-000\-0000;0;_"} allows for the entry of a typical phone number, say 456-123-7890. What needs to be added to the mask to allow for an extension to be typed into the same field right after the phone number?

Thanks....bph





Similar Threads
Thread Thread Starter Forum Replies Last Post
Regular expression for phone numbers [both U.S. an kamii47 BOOK: Beginning Regular Expressions 0 September 8th, 2007 03:08 AM
Removing Blank Spaces in Phone Numbers Brendan Bartley Access 1 April 12th, 2007 11:42 AM
trying to make a custom label for phone numbers... thenoseknows ASP.NET 2.0 Professional 2 August 22nd, 2006 06:07 PM
formatting phone numbers xslt_student XSLT 0 August 7th, 2006 04:10 PM
International Text Chris Beach C# 2 May 24th, 2004 01:47 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.