Suming totals from a report and subreport

  • Thread starter Thread starter ChuckW
  • Start date Start date
C

ChuckW

Hi,

I have a report that lists products with a report footer
at the bottom which sums product sales. It is called sum
(sumofamount). I then imbedded a subreport that contains
shipping. I didn't link the two though but I have a
total in my subreport called sum(shipamount). What I
want to do is to then create a grand total that lists the
sum of my products and the sum of shipping. Can anyone
help?

Thanks,

Chuck
 
ChuckW said:
I have a report that lists products with a report footer
at the bottom which sums product sales. It is called sum
(sumofamount). I then imbedded a subreport that contains
shipping. I didn't link the two though but I have a
total in my subreport called sum(shipamount). What I
want to do is to then create a grand total that lists the
sum of my products and the sum of shipping.


The main report can refer to the total in the subreport
(even when there are no ship records) using a text box named
txtshiptotal eith an expression like :

=IIf(subreport.Report.HasData, subreport.Report.total, 0)

You can add that text box's value to the sales total text
box's value in the grand total text box:

=txtshiptotal + txtsalestotal

I don't understand how you can get the right values if the
subreport doesn't use the Link Master/Child properties to
keep the ship records related to the sales data??
 
Marshall,

Thanks for your help. I am not sure how to link these
two reports together. I was hoping I would not have to
do this. Do I choose "Define My Own" in the wizard and
then select the totals for each report as a link?

Thanks,

Chuck
 
Were you able to get the totals calculation to work?

Sorry, but I find the Wizards too confusing to use for
anything beyond a trivial report. The "linking" is done in
the main report's design view by selecting the subreport
**control** and specifying the main report's primary key and
the subreport's foreign key fields in the control's Link
Master and Link Child properties. If you are getting the
right data in the subreport and don't really understand what
I'm talking about, then it's likely that the wizard linked
the subreport without you realizing it.
 
Back
Top