Rounding Errors on a form

  • Thread starter Thread starter Trent M
  • Start date Start date
T

Trent M

I use the built in round function to round a value in a
form and have that value placed in a text box in the same
form. It rounds correctly to the specified number of
decimal places except when the last allowed number is
even and the number to drop off is a 5. For example:

2.3225 is rounded to 2.322

but 2.3235 is rounded to 2.324

Any solutions??
 
Trent M said:
I use the built in round function to round a value in a
form and have that value placed in a text box in the same
form. It rounds correctly to the specified number of
decimal places except when the last allowed number is
even and the number to drop off is a 5. For example:

2.3225 is rounded to 2.322

but 2.3235 is rounded to 2.324

I believe the Round() function uses "Banker's Rounding" which always rounds to the
nearest even value on a 5. That is what your results are doing. The idea is that in
a large sample of rounded numbers the fives will round up about half the time and
down about half the time and thus small errors cancel rather than compound. You can
create your own expression to produce the "always round 5s up" type of rounding if
that is what you want.

EX:
 
Trent M said:
Thank you very much!! That explains it. Do you know how I
would create my own expression telling it to always round
5s up?

See if the function at the link below will work for you. The description indicates
that it uses Banker's rounding, but the actual code suggests that it is an option
that can be turned off or on as desired.

http://www.mvps.org/access/modules/mdl0054.htm
 
Back
Top