Rounding numbers is not correct

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have some fields that I am totalling. They are all currency fields. In
the code I am running, the fields are 485 and 484.1666 (which should be
484.17) and 460.935 (which should be 460.94).
They view correctly (both on the form and report) when displayed as
currency, but the total only comes to 1430.10 when it should be 1430.11. I
am a penny off. What am I missing?
Thank you in advance for ANY help!
Thanks!

Janis in Minnesota
 
Sometimes you have to go to the report in design view and change the property
 
Janis in Minnesota said:
I have some fields that I am totalling. They are all currency fields.
In
the code I am running, the fields are 485 and 484.1666 (which should be
484.17) and 460.935 (which should be 460.94).
They view correctly (both on the form and report) when displayed as
currency, but the total only comes to 1430.10 when it should be 1430.11.
I
am a penny off. What am I missing?
Thank you in advance for ANY help!
Thanks!

Janis in Minnesota

This is a common mistake: you're confusing the storage of data with the
display of data. The Format of your field controls how the number is
displayed; you only see the two digits, but all four are still stored. When
you add them up, the hidden digits are still there and still add up, causing
the discrepancy.

It's best to use the Round() function to actually round the calculated
expressions to the penny, so what you see corresponds with what's actually
there.

John W. Vionson/MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top