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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

calculating totals from a subReport in a main Report

Status
Not open for further replies.

DracusWolf

Programmer
Aug 23, 2005
7
IE
Hi,

I'm having trouble placing totals and performing calculations from a subform into a main report. I am running three reports as one report and would like to have an overall total and i would also like to do some simple calculations.

Is this possible at all in access??
I have tried to use more subforms to grab the totals but as far as geting calculations to work i'm lost??

Any ideas? It would really save me!!!

Regards,

DracusWolf.
 
DracusWolf
The normal way is to put a text box in the Report Footer of the subreport, to create your total for the subreport, and then reference that text box in the main report. And the correct way to reference a subreport is...
SubreportName.Report!ControlName
alternatively...
[SubreportName].Report![ControlName]


Be aware, however, that if there is a possibility of one of your subreports having a zero sum, you run into trouble, so you need to check for data using the HasData property.

Here is an example from a Statement of Accounts report. In the main report, there is a text box that checks the Total from the subreport (that is the Text35 reference), and uses the HasData property. The -1 means True in Access.
Code:
=IIf([rptAcctSummarySub].[Report].[HasData]=-1,[rptAcctSummarySub].[Report]![Text35],0)

Hope that helps.

Tom


 
Thanks a mil Tom,

I'll give that a go and see if it works!!!

 
Tom,

It works like a dream, i cant thank u enough!!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top