Solved

Grand Total based on calculated sub-group field

Posted on 2013-01-08
10
1,021 Views
Last Modified: 2013-01-08
I have a MS Access Database that track products through 3 different departments.  The report that I have groups items by Item, then by Department then by Operator. I have a calculated subgroup fields (in the department footer) that takes the 1. [SumOfQty] / [SumOfTime] and 2.  [SumOfLaborCost] / [SumOfQty]

Now I want to get a grand total of these calculated fields in the Item Footer. But everytime that I try and reference the calculated field and run the report, it pops up asking for the parameter to be entered.

I have added two files to help explain.

How can I add the sub-groups total lines to a Grand total when they are a calculated field?
Rpt-Problem---Print-Preview.jpg
Rpt-Problem---Report-Design.jpg
0
Comment
Question by:dsheridan
  • 6
  • 4
10 Comments
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 38755786
If I am understanding correctly, ...If it were me, I would do your two calculations in the Reports recordsource, then you could just bring these in as fields( ex: SumOfQtySumOfTime), then you get any summary you wanted  with something like this as a textbox control source:
=Sum([SumOfQtySumOfTime])

JeffCoachman
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 38755815
something like this:
Database171.mdb
0
 

Author Comment

by:dsheridan
ID: 38755879
Let me see if I can clairify so more. I'm getting all the calculations except when I try and add the calculated field into the item footer for CostPerPeice.  I cannot just do a total sum because it would count all depts several times

Looking at your example I have made some modifications so you can see.  
In the new example, let say you cannot simple add all depts as a total so you calculate the subgroup then sum that calculated field. Open the report in design and /or try and run the report.
Database171.mdb
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 38755986
< I cannot just do a total sum because it would count all depts several times>
Not sure I follow...
In my sample, it counts and sums each group only once...

Based on my sample post a clear graphical representation of the *exact* output you are looking for here (based on the exact numbers in my sample)
0
 
LVL 74

Accepted Solution

by:
Jeffrey Coachman earned 500 total points
ID: 38756050
Something like this perhaps:
Database171-1-.mdb
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 

Author Comment

by:dsheridan
ID: 38756254
Great (screen shot to show how it works.
0
 

Author Closing Comment

by:dsheridan
ID: 38756256
Excellent. Problem solved.  I didn’t even think (or know) about the “running sum” function under the properties data tab.

Here’s what I did to fix problem with the help from “boag2000”.

Copied the calculated field into the same group footer and then made the Visible = “No” with a name of the field called “txtSumCPP”.  Then in the Item footer group I made the control source of the total field equal to “=[txtSumCPP]”.  The reason that you need to make a second item is it will keep the running sum in each group footer and would not know what the total for that group was.  I have a screen shot attached to show that it works correctly.

Thank you so much for your help.
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 38756428
No problem
;-)

Sorry I misinterpreted your original request
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 38756761
dsheridan,

And congratulation on investigating the sample extensively on your own to find the "Running Sum" property...
Typically most people will just say "How'd you do that?"

...and you repaired your own report without any direct help form me.

Congratulations, Great work!
;-)

JeffCoachman
0
 

Author Comment

by:dsheridan
ID: 38757393
just neede a nudge in the right direction. Thanks again..;-)
0

Featured Post

Free Gift Card with Acronis Backup Purchase!

Backup any data in any location: local and remote systems, physical and virtual servers, private and public clouds, Macs and PCs, tablets and mobile devices, & more! For limited time only, buy any Acronis backup products and get a FREE Amazon/Best Buy gift card worth up to $200!

Join & Write a Comment

In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
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…

708 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now