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 sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

String to (814) 555-1212 1

Status
Not open for further replies.

prl423

IS-IT--Management
Feb 28, 2006
13
US
How do I convert the string to a phone format. Example is ..... 8145551212 to (814) 555-1212 Thanks in Advance...Using crystal 8.5 SQL DB
 
prl423,

I did this in CR10, hope these functions are available in 8.5.

Code:
whileprintingrecords;
StringVar FormattedPhone;
StringVar AreaCode;
StringVar PrefixThree;
StringVar SuffixFour;

AreaCode:= Left({?Phone},3);
PrefixThree:= Mid({?Phone},4,3);
SuffixFour:= Right({?Phone},4);

FormattedPhone:= "(" & AreaCode & ") " & PrefixThree & "-" & SuffixFour;

Hope This Helps,


Mike
______________________________________________________________
[banghead] "It Seems All My Problems Exist Between Keyboard and Chair"
 
Try:

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

This assumes it's a string, if it'sa numeric use:

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

-k
 
Thanks to those how helped.....much appreciated.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top