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

converting number to text and removing the decimal 2

Status
Not open for further replies.

giggles7840

IS-IT--Management
Mar 8, 2002
219
US
i have a number field that i need to convert to text. when i do that it displays the decimal place from the number field. i need to remove that and then use the new text field as a parameter. any ideas as to the best way to do that?
 
You may be able to try to convert the number to an integer to truncate the decimal places, I am not sure that would work, it probably depends on the type of database.

Another way is to truncate the text by eliminating all of the decimal characters including the decimal point. Something like:

yourString = Left(yourString,Instr(yourString,".") - 1)

It seems a little clumsy but it should work. If it is possible to NOT have a decimal point, you would need to wrap this statement in an If statement.
 
well Left(yourString,Instr(yourString,".") - 1) works nicely except when the number gets to long... then the comas show up. :( any ideas how to get rid of those?
 
well Left(yourString,Instr(yourString,".") - 1) works nicely except when the number gets to long... then the comas show up. :( any ideas how to get rid of those?
 
If you get into the millions and you can have multiple commas you need to first create a loop and step thru each character, check if it is a comma, if so replace it with a zero length string ("").

You might want to search in Google for something to strip commas, you aren't the first person to have this problem.
 
Try using the ToText function:
ToText({Table.NumField}, 0, "")

-dave
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top