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

Passing parameters to a subreport - A new twist

Status
Not open for further replies.

eizatt

Programmer
Jun 19, 2003
12
0
0
US
Hi,

I need to pass a beginning and ending date parameters to a supreport. The problem is that the datasource for the subreport is a SQL command. The command builder will let you define parameters for the command but I can't see a way of using the linked parameters from the main report. Anyone have an idea?

Thanks'
Ed
 
Sounds like your SQL command will have to remain 'as is' but you should still be able to add a selection criteria to include the parameterized date ranges. This will ensure only the correct records are included in the report.


Steve Phillips, Crystal Consultant
 
The problem with that solution is that the report will ask for the date parameters twice. Once on the main report and once for the parameters in the command.
 
No it won't. I'm not suggesting you create a second set of parameters in the subreport - only that you use the linked parameters.

If this doesn't make sense can you explain how you are going about this in a little more detail. You should be able to pass the main report's parameters to the subreport on the subreport links tab. These can be used to select the data in the subreport.

Steve Phillips, Crystal Consultant
 
Since you have the ability to use a SQL Command, can't you design the SQL to return all data in one report using a subquery?

-k
 
I've tried this out now and it works.

1. Create a formula on the main report to set a shared variable equal to the parameter - DO NOT USE WhilePrintingRecords!

2. In the Subreport, Create a formula to pick up the shared variable (display it on the subreport to test)

3. In the subreport's select expert you can use the formula from step 2 to restrict the records

Steve Phillips, Crystal Consultant
 
Thnaks Steve,

I'm going to give it a try.

Ed
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top