View Full Version : Rounding


BB
11-29-2001, 03:57 PM
I was doing this calculation =[Gallons][UnitAmt] and was
having trouble with it not rounding correctly. UnitAmt is
Currency; Gallons is Double(fixed, 1 decimal place). To
correct the problem, I think, I changed it to =CCur(NZ
([Gallons]*[UnitAmt])). I don't really understand why CCur
is correcting the problem. I used NZ because I was getting
#Error in the total field of the next record. I am using
Access97, but this is actually going to be used in 2000.
Is this the correct way to handle all of this??

Thanks, BB

MrP
12-14-2001, 04:31 AM
Hullo,

maybe not the answer your looking for but . . . . . .

the only way i stop rounding problems is by formatting the number everytime i do the calculation. ie
x = format(number1, 0.00) + format(number2, 0.00)

this means that i am only ever doing the calulation to 2 decimal places.

it might work for you, it might not, suck it and see http://www.access-programmers.co.uk/ubb/smile.gif

regards
MrP

pcs
12-14-2001, 10:53 AM
mostly it works because MS got it right for currency type fields...

some good info on the problem appears here:
http://www.fmsinc.com/tpapers/math/index.html

hth,
al


[This message has been edited by pcs (edited 12-14-2001).]