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

Include Two subreports (same report inserted twice) with different parameters for each report

Hi,

I have a crystal report that has a number of subreports,I want to know if I can use the same subreport but pass different parameters twice.  In this case the first subreport is showing everything of a particular status and daterange and the other is showing everything outside this range.  I'm going to create a copy of the inserted sub report and pass the parameters via a dataset but would prefer if possible to not have to create a copy.  I'm using VB.net 2005 to populate the report.
0
geraintcollins
Asked:
geraintcollins
  • 3
  • 2
1 Solution
 
geraintcollinsAuthor Commented:
Oops spoke too soon, not sure how to specify two different sets of criteria on the same table in the dataset.  I guess I need 2 views unless there is another way.
       'Management Action Plan - Sub Report 2
       
        sSQL = "Select * from PlanTable where FPlanID = " & intPlanID
        myDS = GetDataSet(sSQL, "PlanTable")
        rpt.OpenSubreport("ManagementActionPlan-Report1.rpt")
 
        'Management Action Plan - Sub Report 2
 
        sSQL = "Select * from PlanTable where FPlanID = 7"
        myDS = GetDataSet(sSQL, "PlanTable")
        rpt.OpenSubreport("ManagementActionPlan-Report2.rpt")
 
        rpt.SetDataSource(myDS)

Open in new window

0
 
mlmccCommented:
Assuming you are linking the main report to the subreports.

Use the date range as part of the link and the selection criteria.

Open each subreport for editting and change the selection criteria so the first one chooses values in the range and the second values NOT in the range.

mlmcc
0
 
geraintcollinsAuthor Commented:
That's a big help, thanks mimmc.

What if I wanted to pass a parrameter to both of my sub reports from my web form do you know how I'd do that in code?

e.g. I may want to have a field on my form that says status (report 1) status (report2) so that the two sub reports open with different sets of data.
0
 
mlmccCommented:
The easiest way is to put the parameter into the main report then use the subreport links to pass the values to the subreports.

mlmcc
0
 
geraintcollinsAuthor Commented:
Thanks for your help!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

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