Solved

Adding totals in subreport to main report

Posted on 2004-08-15
6
403 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
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

 
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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
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.
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
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.

803 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