mistyinca1970
Member
- Local time
- Today, 05:00
- Joined
- Mar 17, 2021
- Messages
- 117
I have converted a beast of a spreadsheet into an access database. I am working on a query that is being used for an access report. Here's the gist of what it does:
The amounts in here are currency, and there is a specific amount, so coming up a few pennies more or a few pennies less is not acceptable.
There are 8 sums of money, each of these sums is distributed based on a set of percentages (all add up to 100, of course). When I apply distribution percentages to each of these sums, I get a distribution amount. Now when the distribution amounts are added back together (in the report), they often add up to a penny or two more or less than the total, finite sum. I realize this is an issue of multiple hidden places behind the decimal (fractions of a penny) adding back together. But I need to find out how to overcome this.
I have tried using or not using the Round() function. This is not solving the problem.
Is there another function I can try?
This is the query:
(note that in the AvgOfDistribution field, there aren't any hidden decimal places)
Then in the Report, the DistributionAmt field is summed per Zone and a grand total. I'm finding the Zone totals and grand totals are off a penny and sometimes add up to a few pennies more than the actual total.
Here's an example of the math: The query that produced the following 7 figures started with a sum of $227,380.85. As you can see from the snip from the report below, the amounts now add up to $227,380.86. This is with using the Round() function in multiplying $227,380.85 by each of these percentages.
What can I do? Thank you!
The amounts in here are currency, and there is a specific amount, so coming up a few pennies more or a few pennies less is not acceptable.
There are 8 sums of money, each of these sums is distributed based on a set of percentages (all add up to 100, of course). When I apply distribution percentages to each of these sums, I get a distribution amount. Now when the distribution amounts are added back together (in the report), they often add up to a penny or two more or less than the total, finite sum. I realize this is an issue of multiple hidden places behind the decimal (fractions of a penny) adding back together. But I need to find out how to overcome this.
I have tried using or not using the Round() function. This is not solving the problem.
Is there another function I can try?
This is the query:
Code:
SELECT tblDistribution.DistYear, tblDistribution.Order, tblDistribution.ZoneOrder, qrySysEnhancDistribution.Zone, qrySysEnhancDistribution.AvgOfDistribution, tblDistribution.City, tblDistribution.Distribution, Round(([AvgOfDistribution]*[Distribution]),2) AS DistributionAmt, [AvgOfDistribution]*[Distribution] AS NotRounded, "April " & ([DistYear]-1) & " - March " & [DistYear] AS AnnualReport, [DistributionAmt]-[NotRounded] AS Difference
FROM qrySysEnhancDistribution INNER JOIN tblDistribution ON qrySysEnhancDistribution.EffectiveZone = tblDistribution.EffectiveZone
WHERE (((tblDistribution.DistYear)=[Forms]![frmSysEncReport]![cboReportYear]))
ORDER BY tblDistribution.Order, tblDistribution.ZoneOrder;
Then in the Report, the DistributionAmt field is summed per Zone and a grand total. I'm finding the Zone totals and grand totals are off a penny and sometimes add up to a few pennies more than the actual total.
Here's an example of the math: The query that produced the following 7 figures started with a sum of $227,380.85. As you can see from the snip from the report below, the amounts now add up to $227,380.86. This is with using the Round() function in multiplying $227,380.85 by each of these percentages.
What can I do? Thank you!