Calucating Rpt/SubRpt

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a report and an subrpt and would like to calculate a total on the
report using a field from the report and a field from the subreport. Below
is the calculation and whenever I try to run the report, I get a "Enter
Parameter Value". I've tried also pulling the "idamt" from the subreport as
well as from the query. I have had this problem before on other reports and
subreports and can never figure out what I'm doing wrong.

=Sum([amt]+[QRYsubrptInvoice]![idamt])

Any help would be appreciated.
 
margaret said:
I have a report and an subrpt and would like to calculate a total on the
report using a field from the report and a field from the subreport. Below
is the calculation and whenever I try to run the report, I get a "Enter
Parameter Value". I've tried also pulling the "idamt" from the subreport as
well as from the query. I have had this problem before on other reports and
subreports and can never figure out what I'm doing wrong.

=Sum([amt]+[QRYsubrptInvoice]![idamt])


The aggregate functions (Count, Sum, etc) only operate on
fields in the report's record source table/query, they are
unaware of controls on the report and are certainly unable
to dig down into a subreport.

Your reference to the subreport value is also incomplete.
If the subreport is in the main report's header or footer
section, then you want to use:
=Sum(amt) + QRYsubrptInvoice.REPORT!idamt

If the subreport is in the main report's detail section,
then you need to calculate the total from all instances of
the subreport. This is done by adding a text box named
txtRunAmt to the detail section. Set its control source
expression to:

=IIf(QRYsubrptInvoice.REPORT!HasData,QRYsubrptInvoice.REPORT!idamt,0)
and set its RunningSum property to Over All.

Then the grand total in the main report's footer would use
the expression:
=Sum(amt) + txtRunAmt
 
Perfect ... thanks so much for your help on a Sunday morning!

Marshall Barton said:
margaret said:
I have a report and an subrpt and would like to calculate a total on the
report using a field from the report and a field from the subreport. Below
is the calculation and whenever I try to run the report, I get a "Enter
Parameter Value". I've tried also pulling the "idamt" from the subreport as
well as from the query. I have had this problem before on other reports and
subreports and can never figure out what I'm doing wrong.

=Sum([amt]+[QRYsubrptInvoice]![idamt])


The aggregate functions (Count, Sum, etc) only operate on
fields in the report's record source table/query, they are
unaware of controls on the report and are certainly unable
to dig down into a subreport.

Your reference to the subreport value is also incomplete.
If the subreport is in the main report's header or footer
section, then you want to use:
=Sum(amt) + QRYsubrptInvoice.REPORT!idamt

If the subreport is in the main report's detail section,
then you need to calculate the total from all instances of
the subreport. This is done by adding a text box named
txtRunAmt to the detail section. Set its control source
expression to:

=IIf(QRYsubrptInvoice.REPORT!HasData,QRYsubrptInvoice.REPORT!idamt,0)
and set its RunningSum property to Over All.

Then the grand total in the main report's footer would use
the expression:
=Sum(amt) + txtRunAmt
 

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

Similar Threads

For Marshall Barton 23
Total from one subreport to another 6
Help Please 3
Slow report formatting 11
SynNeed to account for null values in subreports 2
SubReports 1
Cross Calculation 1
Report with 2 Subreports 1

Back
Top