Formatting telephone numbers (1 Viewer)

RexesOperator

Registered User.
Local time
Today, 00:49
Joined
Jul 15, 2006
Messages
604
I have used the North American telephone input mask, but I have to be able to display other conventions. I have a separate field for other phone numbers TELEPHONENOTUSCAN. If an input mask is used for telephone numbers, can it be overridden?

I would like to do something like this in an unbound text box:

=IIf([COUNTRY]<>"CANADA" Or "USA",[TELEPHONENOTUSCAN],Replace(Format[TELEPHONE] "(###)-###-####"))

But I am getting a syntax error.
 

WayneRyan

AWF VIP
Local time
Today, 05:49
Joined
Nov 19, 2002
Messages
7,122
RO,

You can always do something like this on the OnCurrent event of your form
and/or the BeforeUpdate event of the [Country] control:

Code:
Select Case Me.Country
   Case "Country1"
      Me.PhoneNumber.InputMask = "(###)-###-####"
   Case "Country2"
      Me.PhoneNumber.InputMask = "Something else ..."
   Case Else
      Me.PhoneNumber.InputMask = "Default Mask ..."
   End Select

Wayne
 

RexesOperator

Registered User.
Local time
Today, 00:49
Joined
Jul 15, 2006
Messages
604
Thanks Wayne - this is on a report. Would this be in the OnOpen Event of the report or on the OnFormat Event of the detail section?

Out of curiosity - why am I getting the syntax error?
 

WayneRyan

AWF VIP
Local time
Today, 05:49
Joined
Nov 19, 2002
Messages
7,122
RO,

The syntax for your Replace function and the format function are wrong.

I didn't realize that this was on a report ... even though it's in the Report
forum.

I'd use the DetailFormat event.

Wayne
 

RexesOperator

Registered User.
Local time
Today, 00:49
Joined
Jul 15, 2006
Messages
604
On Me.TELEPHONE.InputMaskI'm getting a "Method or data member not found" error on the .InputMask string.
 

WayneRyan

AWF VIP
Local time
Today, 05:49
Joined
Nov 19, 2002
Messages
7,122
RO,

I know, given that it's a Report, it'd be a bit difficult to have an InputMask.

I think the Format function should do what you want:

Me.TELEPHONE = Format[TELEPHONE], "(000)-000-0000")

and it's other formats as in the Case statement earlier.

It's getting late ...

hope this works,
Wayne
 

RexesOperator

Registered User.
Local time
Today, 00:49
Joined
Jul 15, 2006
Messages
604
Once I added the second bracket and changed the zeroes to #, it did. Thanks for your insight.
 

Users who are viewing this thread

Top Bottom