Sum 2 subreports total in a main report

G

Guest

Hi,

I have 2 subreports in a unbound main report. Each subreport has total in
its footer.
I would like to sum up the two totals in the footer section of the main
report.
The purpose of this main report is to show the two subreports and the sum of
their totals.
I am unable to find answers in the postings that work for me.
Subreport 1 named "rptCurrentMthOpen]" the sum named"OPEN_Total Grand Total
Sum"
Subreport 2 named "rptCurrentMthShip]" the sum named"SHIP_Total Grand Total
Sum"

How could I get these two totals sum up in my main footer report?

Thanks
Ashley
 
M

Marshall Barton

Ashley said:
I have 2 subreports in a unbound main report. Each subreport has total in
its footer.
I would like to sum up the two totals in the footer section of the main
report.
The purpose of this main report is to show the two subreports and the sum of
their totals.
I am unable to find answers in the postings that work for me.
Subreport 1 named "rptCurrentMthOpen]" the sum named"OPEN_Total Grand Total
Sum"
Subreport 2 named "rptCurrentMthShip]" the sum named"SHIP_Total Grand Total
Sum"


Use the main report text box expression:

=rptCurrentMthOpen.REPORT.[OPEN_Total Grand Total
Sum] + rptCurrentMthShip.REPORT.[SHIP_Total Grand Total
Sum]

It gets messier if there's a chance that a subreport might
not have any data (the total will not exist)

=IIf(rptCurrentMthOpen.REPORT.HASDATA,
rptCurrentMthOpen.REPORT.[OPEN_Total Grand Total Sum], 0) +
IIf(rptCurrentMthShip.REPORT.HASDATA,
rptCurrentMthShip.REPORT.[SHIP_Total Grand Total Sum], 0)
 
G

Guest

Marshall,

Thank for help me out.
I tried it and instead of the total I got #NAME?
Do I need to have something else?

Marshall Barton said:
Ashley said:
I have 2 subreports in a unbound main report. Each subreport has total in
its footer.
I would like to sum up the two totals in the footer section of the main
report.
The purpose of this main report is to show the two subreports and the sum of
their totals.
I am unable to find answers in the postings that work for me.
Subreport 1 named "rptCurrentMthOpen]" the sum named"OPEN_Total Grand Total
Sum"
Subreport 2 named "rptCurrentMthShip]" the sum named"SHIP_Total Grand Total
Sum"


Use the main report text box expression:

=rptCurrentMthOpen.REPORT.[OPEN_Total Grand Total
Sum] + rptCurrentMthShip.REPORT.[SHIP_Total Grand Total
Sum]

It gets messier if there's a chance that a subreport might
not have any data (the total will not exist)

=IIf(rptCurrentMthOpen.REPORT.HASDATA,
rptCurrentMthOpen.REPORT.[OPEN_Total Grand Total Sum], 0) +
IIf(rptCurrentMthShip.REPORT.HASDATA,
rptCurrentMthShip.REPORT.[SHIP_Total Grand Total Sum], 0)
 
M

Marshall Barton

#NAME means that Access couldn't resolve something you used
as a name of whatever it exprected to find in your
expression. THe most likely reason in this case is that you
either misspelled something or you are using the name of the
report objects instead of the name of the subreport controls
that are used to display those objects.

If you have no idea what I'm talking about, open the main
report in design view, click on the border area of a
subreport control and view its properties. Check the Name
property and use that where you have the name of the
(sub)report .
--
Marsh
MVP [MS Access]


I tried it and instead of the total I got #NAME?
Do I need to have something else?

Ashley said:
I have 2 subreports in a unbound main report. Each subreport has total in
its footer.
I would like to sum up the two totals in the footer section of the main
report.
The purpose of this main report is to show the two subreports and the sum of
their totals.
I am unable to find answers in the postings that work for me.
Subreport 1 named "rptCurrentMthOpen]" the sum named"OPEN_Total Grand Total
Sum"
Subreport 2 named "rptCurrentMthShip]" the sum named"SHIP_Total Grand Total
Sum"
Marshall Barton said:
Use the main report text box expression:

=rptCurrentMthOpen.REPORT.[OPEN_Total Grand Total
Sum] + rptCurrentMthShip.REPORT.[SHIP_Total Grand Total
Sum]

It gets messier if there's a chance that a subreport might
not have any data (the total will not exist)

=IIf(rptCurrentMthOpen.REPORT.HASDATA,
rptCurrentMthOpen.REPORT.[OPEN_Total Grand Total Sum], 0) +
IIf(rptCurrentMthShip.REPORT.HASDATA,
rptCurrentMthShip.REPORT.[SHIP_Total Grand Total Sum], 0)
 

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