1. I changed the name to Deducts to try and sum that one column, but it
is
still giving me #Error.
2. Instead of it being SumOfAmount and SumOfCurr Dedn I changed the
column
headings to Payout and Deducts within the report.
3. The data I am trying to sum in a Number. I was Currency, but I changed
it to see if that would help and it did not.
4. I deleted the other calculated field and that did not help. That
calculated field was just =Sum([SumOfAmount])-Sum([SumOfCurr Dedn]).
However, it worked fine.
5. The UNION statement that I am using in the query is as follows:
SELECT Query4.PS, Query4.[LastOfPartner_Name], Query4.[MaxOfPayout Store],
Query4.[CountOfDescription], Query4.[MaxOfDate], Query4.[SumOfAmount],
Query4.[Term Date], Query5.PS, Query5.[LastOfName], Query5.[CountOfDeductn
Cd], Query5.[SumOfCurr Dedn], Query5.[MaxOfPay Period End], Query5.[Term
Date]
FROM Query4 LEFT JOIN Query5
ON Query4.PS = Query5.PS
UNION SELECT Query4.PS, Query4.[LastOfPartner_Name], Query4.[MaxOfPayout
Store], Query4.[CountOfDescription], Query4.[MaxOfDate],
Query4.[SumOfAmount], Query4.[Term Date], Query5.PS, Query5.[LastOfName],
Query5.[CountOfDeductn Cd], Query5.[SumOfCurr Dedn], Query5.[MaxOfPay
Period
End], Query5.[Term Date]
FROM Query5 LEFT JOIN Query4
ON Query4.PS = Query5.PS;
Thank you soooo much for your help!
Allen Browne said:
Some things to check:
1. Does your report have an Amount field?
It did not in your previous example.
2. Make sure the Name of this text box is not the same as the name of any
field in the report's source query.
3. Run the UNION query itself. Does the field left-align (like text), or
right-align (like numbers)? You won't be able to sum it if Access thinks
the
field is just text.
4. Eliminate any other calculated controls until you get this one sorted
out. Once one field is found to be uncalculatable, Access gives up on
calculating the others, so the fault can be in a completely different
place.
5. If you are still stuck, post the UNION query statement.
I tried both the expression below and
=IIf([Report].[HasData], Sum([Amount]), 0)
I am still getting #Error. I am making a report from a query that has
a
UNION join, if that matters. There are negative values, positive
values,
and
lines that have no data (Im assuming are being read as null values).
Thanks
:
Yes, Nulls would matter. So, try this:
=Sum(Nz([Payout],0))-Sum(Nz([Deducts],0))