Frank Dulk said:
As I do to reduce decimal houses in an I calculate in a query
Hi Frank,
I believe you are asking how to
round a calculation in a query that
produces a Single or Double result
to a certain number of decimal
places.
Imagine that your calculation returns
an approximation to Pi.
Below are examples from Immediate
window where the calculation is rounded
to several different decimal places by
what you use for "Houses."
Num!=3.1415926535897932
Houses = .01
? Int(Num! / Houses + 0.5) * Houses
3.14
Houses = .001
? Int(Num! / Houses + 0.5) * Houses
3.142
Houses = .0001
? Int(Num! / Houses + 0.5) * Houses
3.1416
Houses = .00001
? Int(Num! / Houses + 0.5) * Houses
3.14159
In your query calculation you wouldn't
use "Houses"...but replace in formula
with ".01" or ".001" or ".0001", etc.
depending on how many decimal places
you wanted to return.
For example, you have 2 integer fields
in a table in your query ('f1','f2') that you want
to divide and show the result in your query to
3 decimal places.
SELECT ....,
Int((f1/f2)/.001 +0.5)*.001 As Result,
.....
If the fields in your calculation are not integer types,
I suggest you read
"When Access Math Doesn't Add Up"
by Luke Chung President of FMS
http://www.fmsinc.com/tpapers/math/index.html
Good luck,
Gary Walter