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

Subreport Parameter Issue 2

Status
Not open for further replies.
Dec 2, 2003
58
0
0
US
Hi all,
I am using CR 10 with SQL server 2000. I have a report that contains two subreports in the report header. The main report has three parameters and one group. The parameters are
1. fromDate(date)
2. toDate(date)
3. levelinfoid(number)

The problem I am having is that the main report is using the parameters but the subreports are returing all the data in the database and not restricting them by parameters. I have linked the subreports on the field that the group is based on. Can someone please guide me in the right direction? I have tried suggestions from other posts but cant seem to figure it out.

My main report selection formula is:

(({cr_all_informal.lvl1id} = {?levelinfoid})
or
({cr_all_informal.lvl2id} = {?levelinfoid})
or
({cr_all_informal.lvl3id} = {?levelinfoid})
or
({cr_all_informal.lvl4id} = {?levelinfoid}))
and
{cr_all_informal.initial_contact} in {?fromDate} to {?toDate}

I posted this before but wasn't able to get this resolved so I am starting a new thread.
 
Do you have the same parameters created in the Subreports as in the Main Report?
If not, then do so.
If so, then link the Main Report Parameters to the Subreport parameters in the "Change Subreport Links" dialog.

Make sure that the Subreport has the same Record Selection Formula as the Main Report (in addition to the selection that you're passing by linking to the Group Fields)


Bob Suruncle
 
Hello Bob,
I have tried your suggestion and now the subreports are giving me zero results. Below is my record selection formula for both the subreports.

{cr_all_informal.Region} = {?Pm-cr_all_informal.Region}
and
(({cr_all_informal.lvl1id} = {?levelinfoid})
or
({cr_all_informal.lvl2id} = {?levelinfoid})
or
({cr_all_informal.lvl3id} = {?levelinfoid})
or
({cr_all_informal.lvl4id} = {?levelinfoid}))
and
{cr_all_informal.initial_contact} in {?fromDate} to {?toDate}
and
{cr_all_informal.Region} = {?Pm-cr_all_informal.Region}

Did I do something wrong?
 
Ok, I just noticed that
{cr_all_informal.Region} = {?Pm-cr_all_informal.Region}
was in there twice. I have removed it and now the report is returning the correct results. The problem I am having now is that when I refresh the report I am prompted to enter 5 parameter. First 3 from the main report and then 1 from each subreport. Here is how it now.

fromDate(main report)
toDate(main report)
levelinfoid(main report)
levelinfoid (subreport 1)
levelinfoid (subreport 2)

Ideally, it should only prompt me for the first 3 parameters (main report). How can I do this? I appreciate your help and patience.
 
You need to link the {?levelinfold} parameter in the main report to the same parameters in each subreport. Go to edit subreport links and move the main report parameter to the right and then use the dropdown in the bottom left corner to select {?levelinfold} from the subreport (not the default {?pm-?levelinfold}). Repeat for the other subreport.

-LB
 
LB you were absolutely right. Thank you so much for the tip!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top