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

Passing Parameters from main to sub reports

Status
Not open for further replies.

wreiche

IS-IT--Management
Sep 28, 2006
36
CA
I have a main report where I have the user enter the start and end of the time frame in the report. I am trying to pass these to a subreport. From the main report, I am using "edit / subreport links". I select the subreport and try to add the parameters to that subreport. However, when I try to run the report or return to the edit / subreport links, the parameters I have added do not exist.

Any ideas about this?
 
What does add the parmeters to the subreport mean? There is no option to add parameters to a subreport in that screen, and you don't add parameters, you should select the parameter from the main report and then the field that it applies to in the subreport as the link.

The subreport doesn't require parameters, just use the main report parameter to filter the subreport, and if you require other field linking/joining, add those as well.

-k
 
Ishea: That's for an old version of Crystal to work around problems that no longer exist.

However it dawns on me that the problem they're encountering may be because they need to go into the subreport, select Report->Selection formula->record and modigy the selection criteria to use >= and <= for the dates as the link will cretae them as =.

-k
 
synapsevamire, when I wrote "add parameters to the subreport" I meant linking a parameter in the main report to a parameter in the subreport.

What I am trying to do is use start and end/date parameters from the main report in command objects in sub reports. If I just use the parameter defined in the main report without redefining it in the subreport, the command object query returns a 42000 error code, "syntax error or access violation".
 
OK, I just tested it.

Not that you never mentioned Command Objects until now...

When you created the Command Object, you should be creating it's parameters with the appropriate where clause which uses them, and since they are going to > and < than criteria, design accordingly.

Then when you set the links, point the parameter in the main report to the equivalent parameter in the subreport command object. So on the left lower corner select Subeport Parameter to use and point to the appropriate command object parameter for each.

-k
 
I have it working now. There are some glitches in the subreports links interface. Sometimes the links I have set disappear or change. I have several sub-reports, some of which use linked parameters and some which do not. Those that use the linked parameters always use the same two StartDate and EndDate.
 
wreice - for future reference, when you want the sub-report to use the same parameters as the main report you need to create them in the sub-report with the same name they have in the main report. Then go into the select criteria of the sub report and set tham as you did in the main report
ie - {POST.POST_DATE} in {?StartDate} to {?EndDate}

Then in the the set sub report links select your paramters and set them equal to the corresponding parameter in the sub report.
 
Hi RobbieB, my problem is most the same as posted, and I fixed it than it's working fine. However, because my main report is using store procedure with 2 variables and my sub report is also using different sp with 2 same variable as the main one. Anything run ok but forever when I tried to run my report for the first time, it gave me an error message like this: Not Support....Detail: Cannot obtain error message from server. I think this problem is related to pass the parameter from main to subreport. Anyone has any clue why? Please help me. Thanks.
 
Check what is in the Report->Record selection->Record of the subreport and pst what's in there, it may mot be using the < and >.

You can modify it.

-k
 
I don't have anything in Report>Record selection>Record of the subreport. I just get data from store proc to product the cross tab, but anyway I just fix the problem. I just put < print '' > in my subreport store proc before set date variables then it's working. I still don't know how explain but it worked. Do you have any explaination? Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top