Link to home
Start Free TrialLog in
Avatar of defixer
defixerFlag for United States of America

asked on

How can I keep an expression from dropping perenthesis in phone number input mask?

I have a report using the following expression:

=IIf([HomePhone] Is Null,"",[HomePhone] & Chr(13) & Chr(10)) & [MobilePhone] & " (cell)" & IIf([SpousePhone] Is Null,"",Chr(13) & Chr(10) & [SpousePhone] & " (" & [SpouseName] & ")")

The expression does what it is supposed to do, except, I am using an input mask for the phone numbers and so the phone number is coming out without any perenthesis and dashes like it should.  For example, the phone number (111) 222-3333 is coming out on the report as 1112223333 and is unacceptable.  I have searched and have been unsuccessful in finding a solution.  Can this be resolved?

Thanks in advance for help!

defixer
Avatar of ElrondCT
ElrondCT
Flag of United States of America image

If you use a mask, the parentheses and dashes are not actually stored in the database. You need to put them in yourself when you pull the information back out. You may want to set up a function that will do that, but how the function is written depends on what database application you're using. You've posted your question in the dBase zone, but the use of brackets around the field names makes it look like you may be working in Access instead. If you can post what you're working in, I (or someone else) can help you with writing an appropriate function, if you need help.

Avatar of defixer

ASKER

Sorry about that.  When I submitted my question I was pretty sure I selected Microsoft Access.  Guess I goofed.  You are right I'm using MS Access 2003.  Thanks for the reply.
ASKER CERTIFIED SOLUTION
Avatar of ElrondCT
ElrondCT
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of defixer

ASKER

Thank you.  I reposted in the Access Zone and got a fix in just a couple of days.
Avatar of defixer

ASKER

I don't know what the policy is, but he got me pointed in the right direction and when I reposted in the Access Zone where I thought I was when I posted this question I quickly got a solution.  I would like to see him awarded the points if possible because he did try and was very courtious and helpful even though he was unable to give me a resolution a resolution.