View Full Version : Rounding


Don Kemp
02-12-2002, 06:08 AM
Does anyone know what format controls need so that when you do a calculation to one decimal place, the number is rounded not truncated.

e.g. 13.95 is calculated as 13.9 not 14.0

Access calculates 4.5 * 3.1 as 13.9499998092651 (Where do all those extra numbers come from?)

Thanks.
Don

[This message has been edited by Don Kemp (edited 02-12-2002).]

John.Woody
02-12-2002, 07:18 AM
Rounding is always a tricky one. Do you want to round up, or do you want to round down. I am of the impression more people round up. At least on this side of the pond.

Look at integer.

I use the following

Dim x

x = Me.MyStartNo
x = (Int(x * 10000 + 0.5)) / 10000
Me.Myfield = x

This rounds UP to 4 decimal places For one decimal place change 10000 to 10 in both places. To round down take out the 0.5 or try -0.5 to get the results you want.

HTH
John

[This message has been edited by John.Woody (edited 02-12-2002).]