how do I pass value to linked parameters from to subreports

Posted on 2009-02-19
Last Modified: 2012-05-06
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 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


crReportDocument.SetParameterValue("@Parameter1", ParameterValue1);
crReportDocument.SetParameterValue("@Parameter2", ParameterValue2);

crReportDocument.ExportToDisk(CrystalDecisions.[Shared].ExportFormatType.PortableDocFormat, filename)

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!

Question by:jrmc-pgmr
    LVL 8

    Expert Comment

    Im not sure if its the same as I've only ever used the crystal designer built into visual studio, but I was able to interactively look at the parameters collection on the report document at runtime (via the immediate window)

    This helped me sort out a similiar issue.

    Accepted Solution


    Thanks for the help! I got it working after converting the report from version 8.5 to Crystal 11. It turns out Crystal 8.5 is not compatible with VS 2005. Also, I don't need to assign value to the linked parameters in subreport.

    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    How to increase the row limit in Jasper Server.
    This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
    As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
    Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now