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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Subreport Totaling 2

Status
Not open for further replies.

kbfnet

Programmer
Nov 16, 2004
28
US
Hello!

I have a subreport that is subtotaling individual data fields instead on the group of data as a whole. For example:

This is what the totaling currently looks like:

Number of Hours 10.00
Subtotal 10.00
Number of Hours 5.00
Subtotal 5.00

I need it to look like this:

Number of Hours 10.00
Number of Hours 5.00
Subtotal 15.00

Any ideas on how I can make this work?!

Thanks!
kbfnet
 
Are you doing your totalling in the subreport? You should be able to pass it the total so far, using subreport links.

It's probably better to pass back a value using a shared varitable and sum it in the main report. (Do a Search to get details of Shared Variables.)

[yinyang] Madawc Williams (East Anglia, UK) [yinyang]
 
I use the method below:

Create a sub report and use a formula with the following to hold the subtotal amount you want to pass to the main report. Like this:

Formula Name: HoursbyEmp
---------------------------------
WhilePrintingRecords;
Shared CurrencyVar
HoursbyEmp := Sum ({Table1.Hours}, {Table1.Employee})
---------------------------------

Then in the main report create a formula to grab/hold the value from the sub report like this:

Formula Name: sbHoursbyEmp
---------------------------------
WhilePrintingRecords;
Shared CurrencyVar
HoursbyEmp;
HoursbyEmp
---------------------------------

Hope this helps

 
Did it work? Place the field in a section below the section containing the subreport, and see what you get.

If it's not working, display in the subreport and see what is there. I've a feeling you have to actually place the field, though you can suppress it if you don't want it to show there.

[yinyang] Madawc Williams (East Anglia, UK) [yinyang]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top