Form Calculations

H

Hubbymax

I have a form that I am having trouble with. The form is controled by
a query. In the query I have a calculation.

AVG((([OUnitPrice]+[NUnitPrice])/2)*[QuantityIssued]]) AS AVGCOST

I use this calculation to fill a order cost of an item on the form. I
thne have a text box on the form with the calculation, =SUM([AVGCOST])
to show the total cost.

The problem is that if you manually add all the results for the query
calculations the total is 423.25. When the calculation is done by the
form itself it totals 423.24. Any ideas why this happens? It does not
happen for all calculations on the form, most are equal with a manual
addition.
 
D

Dale Fye

Rounding errors. You are dividing by 2 which will get you to the half-cent
(at least 3 decimal places) level of detail.

I'm assuming this is a continuous form with a footer, and you are manually
adding values in a field that is formatted to display as currency. If you
add another textbox next to the first, and change its formatting to display 4
decimal places instead of two, you will probably be able to see where the
discrepancies are coming into the picture.

Use the Sum
 
H

Hubbymax

Rounding errors.  You are dividing by 2 which will get you to the half-cent
(at least 3 decimal places) level of detail.

I'm assuming this is a continuous form with a footer, and you are manually
adding values in a field that is formatted to display as currency.  If you
add another textbox next to the first, and change its formatting to display 4
decimal places instead of two, you will probably be able to see where the
discrepancies are coming into the picture.

Use the Sum

--
----
HTH
Dale



Hubbymax said:
I have a form that I am having trouble with.  The form is controled by
a query. In the query I have a calculation.
AVG((([OUnitPrice]+[NUnitPrice])/2)*[QuantityIssued]]) AS AVGCOST
I use this calculation to fill a order cost of an item on the form. I
thne have a text box on the form with the calculation, =SUM([AVGCOST])
to show the total cost.
The problem is that if you manually add all the results for the query
calculations the total is 423.25. When the calculation is done by the
form itself it totals 423.24. Any ideas why this happens? It does not
happen for all calculations on the form, most are equal with a manual
addition.
.- Hide quoted text -

- Show quoted text -

I must correct myself. This applies to a report not a form. The result
of the query calculation is placed on the reprot as the average cost
for a part. The calculation on the reprort adds all the average costs
for all parts ordered by that department. Can I simply add the row of
AVGCOST placed on the form by the query and have it give me the same
result as using a calculater? Can I have the calculation in the query
round the avarage to 2 decimal points or do this on the report itself
before they are added up?
 

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

Top