PC Review


Reply
Thread Tools Rate Thread

Calculate Subreport totals in a main report Group footer

 
 
ThickMike
Guest
Posts: n/a
 
      1st May 2010
Hi all
Apologies if this has been answered before but I can’t find it.

I have a main Report with a Group called “Product_Category” which lists a
number of “Products” in the Detail

I have a Subreport named “product_costs” which has a record for each date
and Text Boxes named “materials” and “fuel” (there are more but I’ll keep it
simple).
The Subreport sums all costs and has Text Boxes named “summaterials” and
“sumfuel” in the footer (all with a height of 0.1cm)
The Subreport is embedded in the Detail of the Categories and linked by
Product_id

In the Detail of the Main Report there are Text Boxes named “prodmaterials”
and “prodfuel” (all with a height of 0.1cm) which reference “summaterials”
and “sumfuel” in the Subreport footer.
Also in the Detail section, there is a Text Box named “sumprodcost” whose
Control Source is “=[prodmaterials]+[prodfuel]”. So far, so good – it all
works fine

I now want “Category” footer and the Report footer to sum “materials”,
“wages” and “fuel”. I would have thought the Control Source should be
“=sum([prodmaterials])”, etc. but it doesn’t work. Nor does
“=Sum([product_costs].[Report]![Summaterials]).
The Text Boxes are blank whatever I try. I do not get #Error

I have other Text Boxes relating to the “Product” in the Detail and summing
those in the Footer do work.

All cost Text Boxes are formatted as Fixed with zero Decimal Places
I suspect the problem might be that the Subreport is in the Detail rather
than Header or Footer. But it takes up less space the way I’m trying it.

What do I do to make it work?

I know I can do away with the subreport, link costs in the underlying query
and have an extra Group for Product and costs in the Detail. But, I would
rather not do that as it takes up more space on the Report

 
Reply With Quote
 
 
 
 
Allen Browne
Guest
Posts: n/a
 
      1st May 2010
See:
Bring the total from a subreport back onto the main report
at:
http://allenbrowne.com/casu-18.html

It explains how to test the HasData property, and explains the use of the
..Report bit when referring to the report in a subreport.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.


"ThickMike" <(E-Mail Removed)> wrote in message
news3F5F0C1-7948-4719-B256-(E-Mail Removed)...
> Hi all
> Apologies if this has been answered before but I can’t find it.
>
> I have a main Report with a Group called “Product_Category” which lists a
> number of “Products” in the Detail
>
> I have a Subreport named “product_costs” which has a record for each date
> and Text Boxes named “materials” and “fuel” (there are more but I’ll keep
> it
> simple).
> The Subreport sums all costs and has Text Boxes named “summaterials” and
> “sumfuel” in the footer (all with a height of 0.1cm)
> The Subreport is embedded in the Detail of the Categories and linked by
> Product_id
>
> In the Detail of the Main Report there are Text Boxes named
> “prodmaterials”
> and “prodfuel” (all with a height of 0.1cm) which reference “summaterials”
> and “sumfuel” in the Subreport footer.
> Also in the Detail section, there is a Text Box named “sumprodcost” whose
> Control Source is “=[prodmaterials]+[prodfuel]”. So far, so good – it all
> works fine
>
> I now want “Category” footer and the Report footer to sum “materials”,
> “wages” and “fuel”. I would have thought the Control Source should be
> “=sum([prodmaterials])”, etc. but it doesn’t work. Nor does
> “=Sum([product_costs].[Report]![Summaterials]).
> The Text Boxes are blank whatever I try. I do not get #Error
>
> I have other Text Boxes relating to the “Product” in the Detail and
> summing
> those in the Footer do work.
>
> All cost Text Boxes are formatted as Fixed with zero Decimal Places
> I suspect the problem might be that the Subreport is in the Detail rather
> than Header or Footer. But it takes up less space the way I’m trying it.
>
> What do I do to make it work?
>
> I know I can do away with the subreport, link costs in the underlying
> query
> and have an extra Group for Product and costs in the Detail. But, I would
> rather not do that as it takes up more space on the Report
>

 
Reply With Quote
 
ThickMike
Guest
Posts: n/a
 
      1st May 2010
Thanks Allen
I did see this before which made me think the problem lay in the fact I have
the Subreport in the Detail. Your tip (very good, by the way) says to put it
in the Footer.

"Allen Browne" wrote:

> See:
> Bring the total from a subreport back onto the main report
> at:
> http://allenbrowne.com/casu-18.html
>
> It explains how to test the HasData property, and explains the use of the
> ..Report bit when referring to the report in a subreport.
>
> --
> Allen Browne - Microsoft MVP. Perth, Western Australia
> Tips for Access users - http://allenbrowne.com/tips.html
> Reply to group, rather than allenbrowne at mvps dot org.
>
>
> "ThickMike" <(E-Mail Removed)> wrote in message
> news3F5F0C1-7948-4719-B256-(E-Mail Removed)...
> > Hi all
> > Apologies if this has been answered before but I can’t find it.
> >
> > I have a main Report with a Group called “Product_Category” which lists a
> > number of “Products” in the Detail
> >
> > I have a Subreport named “product_costs” which has a record for each date
> > and Text Boxes named “materials” and “fuel” (there are more but I’ll keep
> > it
> > simple).
> > The Subreport sums all costs and has Text Boxes named “summaterials” and
> > “sumfuel” in the footer (all with a height of 0.1cm)
> > The Subreport is embedded in the Detail of the Categories and linked by
> > Product_id
> >
> > In the Detail of the Main Report there are Text Boxes named
> > “prodmaterials”
> > and “prodfuel” (all with a height of 0.1cm) which reference “summaterials”
> > and “sumfuel” in the Subreport footer.
> > Also in the Detail section, there is a Text Box named “sumprodcost” whose
> > Control Source is “=[prodmaterials]+[prodfuel]”. So far, so good – it all
> > works fine
> >
> > I now want “Category” footer and the Report footer to sum “materials”,
> > “wages” and “fuel”. I would have thought the Control Source should be
> > “=sum([prodmaterials])”, etc. but it doesn’t work. Nor does
> > “=Sum([product_costs].[Report]![Summaterials]).
> > The Text Boxes are blank whatever I try. I do not get #Error
> >
> > I have other Text Boxes relating to the “Product” in the Detail and
> > summing
> > those in the Footer do work.
> >
> > All cost Text Boxes are formatted as Fixed with zero Decimal Places
> > I suspect the problem might be that the Subreport is in the Detail rather
> > than Header or Footer. But it takes up less space the way I’m trying it.
> >
> > What do I do to make it work?
> >
> > I know I can do away with the subreport, link costs in the underlying
> > query
> > and have an extra Group for Product and costs in the Detail. But, I would
> > rather not do that as it takes up more space on the Report
> >

> .
>

 
Reply With Quote
 
Allen Browne
Guest
Posts: n/a
 
      2nd May 2010
You can have a subreport in the Detail section, if you want it to appear for
every record.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.


"ThickMike" <(E-Mail Removed)> wrote in message
news:4AD44FC9-294A-4551-BFB3-(E-Mail Removed)...
> Thanks Allen
> I did see this before which made me think the problem lay in the fact I
> have
> the Subreport in the Detail. Your tip (very good, by the way) says to put
> it
> in the Footer.
>
> "Allen Browne" wrote:
>
>> See:
>> Bring the total from a subreport back onto the main report
>> at:
>> http://allenbrowne.com/casu-18.html


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
subreport totals on Main report TotallyConfused Microsoft Access Reports 3 8th Oct 2008 06:15 PM
Showing Totals from Subreport on Main Report Darrell Microsoft Access Reports 5 17th Jul 2008 05:06 PM
Totals from SubReport in Main Report =?Utf-8?B?QW1hbmRh?= Microsoft Access 1 24th Sep 2007 12:28 PM
SubReport Totals in Main Report footer =?Utf-8?B?YXQ=?= Microsoft Access Reports 1 22nd Aug 2006 05:06 AM
Q: Subreport totals doubling in main report MarkD Microsoft Access Reports 0 25th Aug 2004 05:14 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:40 PM.