problem with adding 4 decimal numbers

  • Thread starter Thread starter Maria Beylo
  • Start date Start date
M

Maria Beylo

I am totaling 3 different groups (Total Cost, Total
Surcharge and Total Due. These numbers are all currency
format with 4 decimal places. However the sum of these
groups need to be 2 decimal places (for invoices). I am
using currency format with auto decimal places.

The problems is that the sum of the Total Cost and Total
Surcharge should equal the Total Due, however sometimes it
is off by 1 cent.

I have tried everything I can think of, however I am very
new and self taught with Access 2000. Have been looking
for a way to write an event procedure that would plus or
minus one to make the Total Cost and Total Surcharge equal
Total Due.
Thank you
 
The problems is that the sum of the Total Cost and Total
Surcharge should equal the Total Due, however sometimes it
is off by 1 cent.

Even if you are only displaying two decimals, the fields are still
stored with all four: a Currency datatype always has four decimals, no
more and no fewer.

The solution is to use the Round() function in all your calculations
which might return extra decimals:

Tax: Round([Cost] * [TaxRate], 2)

for instance.
 

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