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!

Apply Selection Criteria directly to Subreports 1

Status
Not open for further replies.
Aug 11, 2004
53
CA
CR10, SQL2K

So, I've been working with subreports for a little while, and I have a question. Is there a way to force your subreports to inherit the selection criteria and group criteria from the main report?

For example, using the following field/table structure:
UID
TRANS TYPE
AMOUNT
REFERRAL TYPE
BRANCH

I have the main report selecting only one BRANCH based on a parameter, then grouping the records by UID.

Then, in the group header a+b, I have subreports that provide more details on TRANS TYPE + REFERRAL TYPE respectively.

What I'd like is the selection criteria and grouping in the main report to be relfected in data availabe to the subreport. (ie, the data in any specific instance of a subreport should only to pertain to one BRANCH and one UID as broken down by the selction criteria and grouping in the main report. What I get is the entirety of my data available to the subreports, not narrowed down in anyway by the criteria specified in the main report.

Is there an easy way to accomlish what I'm doing? In the past, I've simply repeated the selection criteria in the subreports, but as my selection criteria grows and my subreports become more numerous, this method becomes more an more tedious.

Help, please, if you can!

Thanks,
Jason
 
On your main report, select [Edit] and then [Subreport Links]. Pass the parameters to the subreport, which will use them.

Note that this will automatically add a statement to the subreport record selection. Check it and see if it is what you want.

[yinyang] Madawc Williams (East Anglia, UK) [yinyang]
 
OK, that works for my selection criteria, but what if I want my subreports to follow the grouping rules of the main report as well?
 
Almost any field can be passed. Where are you putting your subreports?



[yinyang] Madawc Williams (East Anglia, UK) [yinyang]
 
I've made sense of it now, and everything is working great, thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top