casatone
asked on
Set parameter values in subreport from VB6 / Crystal XI
I have an existing Crystal Reports XI report but have recently added an *unlinked* subreport. I have the subreport working through Crystal's IDE, but now I need to integrate it into my VB6 app.
The datasource for the subreport is a SQL 2000 stored procedure with 5 input parameters.
The main report has a different datasource, and I successfully am passing the parameter values to it. Again, the main report is not linked to the subreport.
The issue is that I don't know how to pass values to the subreport through the VB code.
The datasource for the subreport is a SQL 2000 stored procedure with 5 input parameters.
The main report has a different datasource, and I successfully am passing the parameter values to it. Again, the main report is not linked to the subreport.
The issue is that I don't know how to pass values to the subreport through the VB code.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
frodoman can you explain how to go about that or post a sample? Unfortunately I don't know how to do that.
ASKER
I also tried this approach set the parameters:
gReport.ParameterFields.Ge tItemByNam e("@StopDa te_From", "Subreport1").AddCurrentVa lue mStopDate_From
"gReport" is an object variable that refers to the main report. I figured since the subreport ("Subreport1") is named in the main report, perhaps I could get the values passed that way.
Unfortunately, this approach results in the following error message:
Run-time error '-2147189553 (80047ccf)': The value or range you are adding has already existed.
gReport.ParameterFields.Ge
"gReport" is an object variable that refers to the main report. I figured since the subreport ("Subreport1") is named in the main report, perhaps I could get the values passed that way.
Unfortunately, this approach results in the following error message:
Run-time error '-2147189553 (80047ccf)': The value or range you are adding has already existed.
In the Field Explorer, simply add the parameters you need in your main report. Then rt-click on the subreport and select "change links". Click on the parameter in your main report and select it, then select the parameter from the dropdown for your subreport.
Now you can pass these parameters directly to your main report and they'll be passed through to the subreport.
Now you can pass these parameters directly to your main report and they'll be passed through to the subreport.
ASKER
Got it working. I kept trying different approaches, but ultimately found a way that was based generally off of mlmcc's link with a sample...really needed a sample to get my brain around this. So, I split the points to be fair because I think you both (mlmcc & frodoman) helped guide me there. Thanks very much.
Glad i could help
mlmcc
mlmcc
ASKER