View Single Post
  #2  
Old May 26th, 2010, 02:01 PM posted to microsoft.public.access.reports
John Spencer
external usenet poster
 
Posts: 7,815
Default Total is off by a couple of cents

The problem is that Taxes needs to be rounded off during the calculation.

Taxes: Round(([matsales]+[scharge])*0.0875,2)

AND when you sum
SUM(Round(([matsales]+[scharge])*0.0875,2))

Otherwise small discrepancies are going to creep into your calculation of the
Total Tax. You may see 0.39 for the calculation [matsales]+[scharge])*0.0875
but the actual result may be 0.39375. When you total a few like that before
rounding you end up with extra pennies. On the other hand .3965 will display
as .40 and total a few of those and you might loose a penny or two.

John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County

FCP wrote:
I have a report that feeds of a query. The query has the following fields
matsales: [order details]!unitprice*[order details]!quantity
scharge: [order details]!surcharge*[order details]!quantity
Taxes: ([matsales]+[scharge])*0.0875

0.0875 is that tax values

On the report the sum in the footer =Sum(matsales) and = Sum(scharge) are
correct however, =Sum(Taxes) is off. For example the total should be $161.88
after the taxes has been rounded off in two decimal places but its giving me
$161.85 the actual total if the taxes were not rounded off.

The matsales and scharge total are correct and they are rounded as well. I
think the problem im having is similar in excel if its not "Set as precision
as displayed."
I have tried every possible format in both the sum field in the report and
query, I even converted the numbers to CSng or Cdbl. Tried rounding off the
quesry as well, and none worked.

Is there a way on access to sum the values as displayed if not is there a
solution for the problem I described above.

Thanks