Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Subtotals in Main Report?

Status
Not open for further replies.

VoodooRage

Programmer
Oct 9, 2002
43
US
I have a main report that I am using along with two sub reports to collect all the data.

Main Report
Group 1
Group 2
Detail 1 Detail 2 SubReportDetail 1 SubReportDetail 2
Group Footer 2
SubTotal SubTotal SubTotal SubTotal
Group Footer 1
SubTotal SubTotal SubTotal SubTotal

My problem is how can I get subtotals from the detail columns that are actually a subreport. I have tried referencing them useing =Sum([Reports]![Main Report]![SubRpt1]![SubDetail1] but this does not return a value.

I hope I have illustrated this where someone can understand the problem. I just need to get subtotals from a sub report?

Thanks everyone!
 
VoodooRage
Put a Sum structure in the Report Footer section in each of the two subreports, and then reference those controls in your main report, using...
= subreport1.Report!ControName1 + subreport2.Report!ControlName2

If there might be zeros in any of the subreports, you will want to build in either an IIf or an Nz to allow for that. You may also want to look at the HasData property to check whether or not a subreport contains data.

Here is an example from one of my reports, which has two subreports.
=IIf([rsubJulyToDecemberItemized subreport].[Report].[HasData]=-1,[rsubJulyToDecemberItemized subreport].[Report]![Text22],0)+IIf([rsubJanuaryToJuneTotals subreport].[Report].[HasData]=-1,[rsubJanuaryToJuneTotals subreport].[Report]![Text19],0)

Hope that helps.

Tom

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top