how do I pass value to linked parameters from to subreports
Posted on 2009-02-19
I am working on a windows application to export the report built in Crystal Report 8.5 to a directory on the server. I am using VB.net 2005 and Crystal Report 8.5.
The report has one main report and one subreport. The subreport has three parameters that linked back to the main report, and the main report itself has two parameters. The main report calls one stored procedure and the subreport calls another stored procedure. The report runs fine inside Crystal Report designer. However, it returns a blank report when I ran it inside windows application.
I set the parameters values for the main report with following code, and it returns data if I REMOVED THE SUBREPORT
Dim crReportDocument As New ReportDocument
crReportDocument = New ReportName
However, when I added the subreport back and try to set paramter values for the subreports by using the following code,
crReportDocument.SetParameterValue("@SubReport_Parameter1", subReportParameterValue1, "subRepName");
crReportDocument.SetParameterValue("@SubReport_Parameter2", subReportParameterValue2, "subRepName"););
I got "illegal operation on linked parameters" error.
then, I commented out the two lines of code that set parameter values on sub report, but I found none of values is passed from main report to sub report when I run SQL profile trace. and I didn't get 'Missing Parameter values' error neither.
I searched the internet before posting the question, someone posted links for examples of how passing subreport parameters in .NET, but I wasn't be able to open the links.
Thanks inadvance for your help!