Rounding values can be a daunting task. If you have Access 2000 or newer, you have the Round Function you can use for many of your calculations. If you are using Access 97 or have calculations that don't fit in the Round Function format you can try one of these to accomplish what you need. Edited 1/11/07. to adjust for floating point issues with VB6.3
Place them in a new column in your query and replace myField with the name of your Numeric Field.
To round to 1 decimal place
myVal:Int(CDec((myField + 0.05) * 100)) / 100
123.45 returns 123.5
123.44 returns 123.4
To round to 2 decimal places
myVal:Int(CDec(myField+.005)*100)/100
123.456 returns 123.46
123.454 returns 123.45
To round to the nearest ONE digit
myVal:Int(myField + .5)
123.55 returns 124
123.45 returns 123
To round to the nearest TEN digit
myVal:Int(((Int(myField) / 100) + 0.05) * 10) * 10
128.45 returns 130
123.45 returns 120
To round to the HIGHER TEN digit
myVal:Int((((myField + 0.999) / 100) + 0.09) * 10) * 10
1.01 returns 10
10 returns 10
10.01 returns 20
The alias myVal can be replaced by any text value you want for a field name.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.