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

Convert Number to String

Status
Not open for further replies.

sopomeres

MIS
Jan 16, 2003
61
US
I have 'daycount' field which displays number data this way: 1.00

How can I convert it to be displayed as D001? I would like to drop the decimal, convert the number to a 3 character string, and place a "D" prefix. How can this be done?

Thank you.
Chuck
 
You can use something like :

Left("D000", 4-Length(totext(DayCount))) + totext(DayCount)

But you have to be make sure Daycount never goes over or equals 9999.5 (totext rounds .5 up) or you will get an error (just test it first), if over 999, you will lose the "D" as well.
 
Do a formual field:
"D" & totext({daycount}, "000")

Madawc Williams
East Anglia, Great Britain
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top