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

Trim Digits after decimal point

Status
Not open for further replies.
Aug 9, 2006
17
GB
Hello,

I have been asked to trim a number field in an Access database to remove all but the first two digits after the decimal point. The number of digits before the decimal point varies and I have am having some difficulty creating a script that will ignore the digits before the point and just trim those after.

If anyone has any suggestions I will be most grateful.
 
You can use both Round and Format, but be aware that they give different results:

[tt]?Round(12.985,2)
12.98

?Format(12.985,"#.00")
12.99[/tt]
 
For positive numbers anyway: Take number times 100. Round down to the nearest integer and divide by 100...

INT(<VALUE> * 100)/100

For positive and negative...

IIF(<Value> < 0,-1,1) * INT(ABS(<VALUE>) * 100)/100
 
You may try this:
Fix([decimal field]*100)/100

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top