Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sum costs over multiple groups

Status
Not open for further replies.

Wiznane

IS-IT--Management
Oct 18, 2000
21
US
I have a table set up with a repair order, the cost, date, and unit of that order. It is in a one-to-many relationship with a table holding the repair details.
My resulting query returns something like the following

Unit Month Order # Cost Repair description
1 10 100 $100.00 Oil Filter
1 10 100 $100.00 Air Filter
1 10 100 $100.00 Engine
2 11 101 $250.00 Oil Filter
2 11 101 $250.00 Tires
....
and so on.
Now, in my report, it is grouped first by Unit, then Month, then repair order, then repait description. This works and look lovely, but I cannot get it to sum the costs for the unit for that month.
Putting Sum([Costs]) in the unit footer adds up everything (all the duplicate $100.00s for example), so I figured just putting running sums in one of the headers or footers would do it, but nothing so far.

Any suggestions? Maybe redesigning the query somehow?
 
Nevermind. Got it with a
=DSum("[Cost]","tblForkliftMaintenance","[Unit]=[Reports]![rptForklift]![Unit]")
control in the outermost (Unit) footer.
Still, if there any design thoughts on this, I'd still be glad to hear it. There's probably an easier way to achieve this.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top