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

Converting Numerical field to a Text field.

Status
Not open for further replies.

honeyrun

Technical User
May 18, 2000
7
US
I have a numerical field (with a decimal) that I need to convert to a text field (without decimal). I can get the decimal to go away by using "Replace([Amount],".",""), but ending zeros are not showing. I also need leading zeros to fill the field to 10 characters. Any help would be appreciated.

Thanks,
 
Try this expression:

Format(Mid$(Cstr([Amount]),1,Instr(1,Cstr([Amount]),".")-1),"0000000000")

Post back with questions

Bob Scriver
Want the best answers? See FAQ181-2886
Nobody believes the official spokesman... but everybody trusts an unidentified source.
Author, Bagdad Bob???

 
Bob,

That partially worked, but the 2 numbers after the decimal didn't convert, they were left off. Is there a way to convert them also, including if the ending number is a zero?

Thanks
 
Norris68,

That converted the number to text, but rounded the two decimal places up to a whole number. I still need the two decimal places to convert to text also without the decimal point.

Thanks,
 
How about... Format([NumericField]*100,"0000000000")

or if you want to keep the decimal places... Format([NumericField],"00000000.00")
 
Norris68,

That was it, Thank you very much [2thumbsup]
 
honeyrun: As you can see you didn't ask for a rounding expression. You just wanted the decimals to go away. Norris68 has given you a good expression to that and is better than mine. Less complex is better.



Bob Scriver
Want the best answers? See FAQ181-2886
Nobody believes the official spokesman... but everybody trusts an unidentified source.
Author, Bagdad Bob???

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top