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

Adding subreport and main values

Status
Not open for further replies.

IceRuby

Technical User
Jan 20, 2004
85
AU
Hello All

Two problems -
1. Can Subreport and Main report values be added?
2. How can a Grandtotal be displayed in Main report
next to other Grandtotals? (see below)

Main report list a count per category type then a subreport is applied next to main report to create columnar values.
Example of what report looks like at moment and what needs to be added. (marked with ???HOW)
(???HOW)
product type (group) mainreport subreport SUM
count count

Travel 12 3 15

Hotel 6 4 10

GRANDTOTAL 18 (???HOW) 7

Thanks in advance
 
Why would you use a subreport for this?

Anyway, since you're grouped at the product type, link the subreport by this field, and then pass a variable back to the main report for display, rather than using the subreport for display:

Right click the main report group header and select insert section below

Place the subreport in GH1 B and link it

Create a formula in the main report GH1 A to initialize a variable, as in:

whileprintingrecords;
numbervar SubCnt:=0;

Create a formula in the subreport to return the value:

whileprintingrecords;
numbervar SubCnt:= sum({table.field});

Or however you obtain the value

Once the subreport has fired (meaning in the main report after GH1 B), you can use the following to retrieve the value:

whileprintingrecords;
numbervar SubCnt

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top