?
Solved

Adding totals in subreport to main report

Posted on 2004-08-15
6
Medium Priority
?
409 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

 
LVL 5

Accepted Solution

by:
peterpuscas earned 2000 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

10 Questions to Ask when Buying Backup Software

Choosing the right backup solution for your organization can be a daunting task. To make the selection process easier, ask solution providers these 10 key questions.

Question has a verified solution.

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

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
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…
Suggested Courses

801 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