A
Ally
Sharkbyte,
After trying serveral times with your suggestion, I think it works when I
try this in the query:
SELECT Sum(TABLE1.POAmt) AS SumOfPOAmt
FROM (SELECT TABLE1.[PO#], TABLE1.POAmt FROM TABLE1 GROUP BY TABLE1.[PO#],
TABLE1.[POAmt]);
I did the similar query for CapAmt as well. I got the right numbers of total
amount of POAmt and CapAmt when I run the above queries.
The thing is that I need these numbers printed on the report for Project
subtotal on Project footer and grand total on report footer. I put this
expression: "=(the above query)" in the control source of the text control on
the project footer and report footer. However, no number except "#Name?" is
printed out on the place that I was expecting to see the sum. Would anyone
please tell me why it fails to print the right sum number on the report
although the the report get data from the TABLE and although it works in the
query?
Thanks a lot!
Ally
After trying serveral times with your suggestion, I think it works when I
try this in the query:
SELECT Sum(TABLE1.POAmt) AS SumOfPOAmt
FROM (SELECT TABLE1.[PO#], TABLE1.POAmt FROM TABLE1 GROUP BY TABLE1.[PO#],
TABLE1.[POAmt]);
I did the similar query for CapAmt as well. I got the right numbers of total
amount of POAmt and CapAmt when I run the above queries.
The thing is that I need these numbers printed on the report for Project
subtotal on Project footer and grand total on report footer. I put this
expression: "=(the above query)" in the control source of the text control on
the project footer and report footer. However, no number except "#Name?" is
printed out on the place that I was expecting to see the sum. Would anyone
please tell me why it fails to print the right sum number on the report
although the the report get data from the TABLE and although it works in the
query?
Thanks a lot!
Ally
Sharkbyte said:You will need something like this:
SELECT Sum(POAmount) AS SumOfPOAmount FROM (SELECT POAmount FROM Table1
GROUP BY POAmount);
Use the same subquery structure for your CapAmount.
HTH
Sharkbyte
Ally said:I have three group levels in a report which gets data from a table. The
report is grouped first by project#, then Cap# and PO# and there is an
numeric filed in both Cap# group and PO# group. For example, there is
CapAmount related to Cap# and POAmount related to PO#. One Project# might
have multiple Cap# and one Cap# might have multiple PO#. I know that I can
set HideDuplicates property to Yes or simply use grouped level in the report
to prevent duplicate data from being printed on a grouped data. However, the
total sum of the amount in each level (CapAmount and POAmount) was not
correct using =sum([CapAmount]) and sum([POAmount]) at the project footer.
It's way larger than it's supposed to be and it seems that those hided lines
with numeric fields are still be counted, which causing the final result way
larger than what they are supposed to be. Would you please let me know what's
the best way to solve this? How should I only sum the numeric field in the
group level not record level? Thanks a lot!!!