Subreports

  • Thread starter Thread starter Krisse
  • Start date Start date
K

Krisse

I have a report named rptProject that has a subreport
control named rptCompensation in the detail section.
This subreport has a control named SumOfCompensation.

The subreport control displays the correct summarized
data for each detail line.

On my report footer, I would like to display the sum of
SumOfCompensation. I tried creating the bound text box
myself and again by using the wizard, but when I run the
report, it doesn't recognize the datasource for my report
footer text box.

Here is an example of what I tried. I added the =sum to
what the wizard gave me.

=Sum([rptCompensation].[Report]![SumOfCompensation])

Any ideas?
 
Krisse said:
I have a report named rptProject that has a subreport
control named rptCompensation in the detail section.
This subreport has a control named SumOfCompensation.

The subreport control displays the correct summarized
data for each detail line.

On my report footer, I would like to display the sum of
SumOfCompensation. I tried creating the bound text box
myself and again by using the wizard, but when I run the
report, it doesn't recognize the datasource for my report
footer text box.

Here is an example of what I tried. I added the =sum to
what the wizard gave me.

=Sum([rptCompensation].[Report]![SumOfCompensation])

The aggregate functions only operate on fields in the
report's record source table/query, they do not understand
controls on the report.

You need to add an invisible(?) text box to the main
report's detail section. Let's name this new text box
txtRunComp, set its control source expression to:
=IIf(rptCompensation.Report.HasData,
rptCompensation.Report!SumOfCompensation, 0)
and set its RunningSum property to Over All.

Then the grand total text box in the report footer would use
the expression:
=txtRunComp
 
Looks great! Thanks, Marshall!
-----Original Message-----
Krisse said:
I have a report named rptProject that has a subreport
control named rptCompensation in the detail section.
This subreport has a control named SumOfCompensation.

The subreport control displays the correct summarized
data for each detail line.

On my report footer, I would like to display the sum of
SumOfCompensation. I tried creating the bound text box
myself and again by using the wizard, but when I run the
report, it doesn't recognize the datasource for my report
footer text box.

Here is an example of what I tried. I added the =sum to
what the wizard gave me.

=Sum([rptCompensation].[Report]![SumOfCompensation])

The aggregate functions only operate on fields in the
report's record source table/query, they do not understand
controls on the report.

You need to add an invisible(?) text box to the main
report's detail section. Let's name this new text box
txtRunComp, set its control source expression to:
=IIf(rptCompensation.Report.HasData,
rptCompensation.Report!SumOfCompensation, 0)
and set its RunningSum property to Over All.

Then the grand total text box in the report footer would use
the expression:
=txtRunComp
 
Back
Top