Solved

Adding totals in subreport to main report

Posted on 2004-08-15
6
405 Views
Last Modified: 2009-04-29
I know this has been asked before and I've tried every one of the solutions.  So here I am.  I need to bring a sum from my subtotal into my main report.  This is what I tried (and failed):  =[Qry_Count_Unit_Awards_by_Unit subreport].[rpt_Award_Totals_by_Unit]![SumofAwards]

That is trying to just bring my sum field into the main report to use it.  The first field is my subreport, the second is my main report and the third is my sum field.  

Any suggestions welcome - and I'm an Access novice, so type slowly ;-)

- Sarah
0
Comment
Question by:Kindir
  • 3
  • 2
6 Comments
 
LVL 16

Expert Comment

by:ahmedbahgat
ID: 11803875
Hello Sarah

i do it this way :

1. in the main report make the Grand Total box non bund to any thing, make its name GrandTotal and is located in the report footer
2. in the sub report, assume the sub total box is named "SubTotal1"
3. in the main report assume the sub total box is named "SubTotal2"

4. use the OnFormat event for the main report footer section as follow:

me.GrandTotal= Me.SubTotal2 + Me.SubReport.Report!SubTotal1

cheers
0
 
LVL 5

Expert Comment

by:peterpuscas
ID: 11803995
Just make the text field wich shows the SumOfAwards invisible on the subreport,than
use something like this on the main report:

=[Qry_Count_Unit_Awards_by_Unit subreport].Report.[textFieldFromSubreport]

you have to replace textFieldFromSubreport with the invisible field from subreport

Peter
0
 

Author Comment

by:Kindir
ID: 11804673
Thanks, I have it working somewhat but when I put it in the main report it shows #error when there are no records.  When it was in the subreport it didn't do that.  Any idea how to get rid of the #error when there is no sum?  A zero would be fine, but not the error!

- Sarah
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 5

Accepted Solution

by:
peterpuscas earned 500 total points
ID: 11804828
Use this for the control source:

=IIf( IsError( [Qry_Count_Unit_Awards_by_Unit subreport].Report.[textFieldFromSubreport])," ",=[Qry_Count_Unit_Awards_by_Unit subreport].Report.[textFieldFromSubreport])

Peter
0
 

Author Comment

by:Kindir
ID: 11805955
Thanks for your continued help Peter!  Now it's giving me invalid syntax - any idea what that could be?  

- Sarah
0
 
LVL 5

Expert Comment

by:peterpuscas
ID: 11815706
You have to change [textFieldFromSubreport] with the name of your text field,
it has two appearences.

Peter
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

680 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question