• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 5834
  • Last Modified:

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.

0
casatone
Asked:
casatone
  • 4
  • 2
  • 2
2 Solutions
 
mlmccCommented:
Check this out. It is for CR 9 but the RDC hasn't changed much

http://support.businessobjects.com/communityCS/FilesAndUpdates/cr9_vb_rdc_parameter.exe.asp

mlmcc
0
 
frodomanCommented:
If that doesn't work, you can always add the parameters to your main report and link them to the subreport.  There's no rule that says the parameters have to be used in your main report for anything, then can exist there only to simplify passing to a subreport.

It's not that you can't pass params to a subreport - you can - but it may be easier to just add them to you main report in some cases.

frodoman
0
 
casatoneAuthor Commented:
mlmcc, I tried using the sample you posted & think it got me closer, though I keep getting prompted for the subreport's parameter values (as Crystal does from within its designer).
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
casatoneAuthor Commented:
frodoman can you explain how to go about that or post a sample?  Unfortunately I don't know how to do that.
0
 
casatoneAuthor Commented:
I also tried this approach set the parameters:  

        gReport.ParameterFields.GetItemByName("@StopDate_From", "Subreport1").AddCurrentValue 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.


0
 
frodomanCommented:
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.  
0
 
casatoneAuthor Commented:
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.
0
 
mlmccCommented:
Glad i could help

mlmcc
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now