How do I display a phone number format from a text field?

G

Guest

My phone info is in a text field and there is no format for phone numbers,
only date/time. I can't apply an input mask after the fact.
 
F

fredg

My phone info is in a text field and there is no format for phone numbers,
only date/time. I can't apply an input mask after the fact.

And in what country's format?
This group has readers all over the world.
In the US we have many different formats, i.e.
123.456.7890, 123 456-7890, (123) 456-7890, 456-7890
In what format would you like to display the number?
And do they all include an area code? Or not?

By the way, you can apply an input mask after the fact in a report.
It will display the phone numbers in the report the way the mask is
set up, but it will not change the actual data stored in the table.
 
M

Marshall Barton

BBdoll said:
My phone info is in a text field and there is no format for phone numbers,
only date/time. I can't apply an input mask after the fact.


There is very little you can do to format a Text field. If
your phone numbers are all digits, you can use something
like this:
(@@@) @@@-@@@@
 
G

Guest

Thanks for replying. My format is (123) 234-2345
My field contains text that is simply a string of ten numbers. I want to be
able to display the field, but use the nice parenthesis and dash. I cannot
apply an input mask because I am displaying several fields in one string. I
can only type the format into the line of code.
 
F

fredg

Thanks for replying. My format is (123) 234-2345
My field contains text that is simply a string of ten numbers. I want to be
able to display the field, but use the nice parenthesis and dash. I cannot
apply an input mask because I am displaying several fields in one string. I
can only type the format into the line of code.

Then Marsh Barton gave you an answer:

= "You can phone me at " & Format([Phone],"(@@@) @@@-@@@@")

Another alternative:
= "You can phone me at " & IIf(Len([Phone]) = 10, "(" &
Left([Phone],3) & ") " & Mid([Phone],4,3) & "-" & Right([Phone],4),
IIf(Len([Phone]) = 7, Left([Phone],3) & "-" & Right([Phone],4)," No
phone available")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top