Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Phone # Formula or Function 2

Status
Not open for further replies.

Bentk

Programmer
Feb 18, 2005
9
US
I am trying to format a phone number that is a string to look like this.

Currently the info returned from SQL is 1234567890
I need to make it format to 123-456-7890
Does anyone know of a function or formula that could make this happen?

Thanks in advance,
Bentk
 
Write a formula:

Picture({yourField},"xxx-xxx-xxxx")

Software Sales, Training, Implementation and Support for Macola, eSynergy, and Crystal Reports
 
Try a formula containing:

picture(totext({table.field}), "XXX-XXX-XXXX")

You also might want to sanity check, as in:

If len(trim({table.field})) = 10 then
picture(totext({table.field}), "XXX-XXX-XXXX")
else
"!!!" &{table.field}&"!!!"

-k
 
k
Thanks so much, I was not aware of the picture function. That's a lifesaver. Worked like a champ.

Thanks,

Bentk
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top