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

Formating a field 1

Status
Not open for further replies.
Feb 26, 2004
58
US
I am somewhat new to Crystal.

I need to format a Zip Code field xxxxx-xxxx
and a phone number xxx-xxx-xxxx.

What is my best way to do that. I have looked at the format dialog box and can't seem to find a simple way of doing that.

I am in Crystal 8.5 or 9.0. I use both. I am running with an Access database.

The fields are currently numeric fields in access.

Any help would be appreciated.

THank You!
 
Take a look at the picture function.

picture({Customer.zipcode},"xxxxx-xxxx")

picture({Customer.Phone},"xxx-xxx-xxx")


~Brian
 
You'll need to convert these fields to text first, as the Picture function uses a text field as it's first argument.


Picture(Cstr({Customer.zipcode},0,''),"xxxxx-xxxx")

picture(Cstr({Customer.Phone},0,''),"xxx-xxx-xxx")

HTH



Bob Suruncle
 
Bob's suggestion may or may not apply to phone number. As for zip code, I would be really surprised if it was not stored as text since there are zip codes that start with zero. If the zip code is stored as numeric, you will probably have to start check lengths first to determine if there should be a leading zero or not.

~Brian
 
you can even try this
{customer.zipcode}[1 to 5] + "-" + {customer.zipcode}[6 to 9]
Similarly for Phone no.

Hari
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top