?
Solved

Pass Parameters to subreport vb ocx

Posted on 2006-04-13
4
Medium Priority
?
389 Views
Last Modified: 2008-02-01
I have a report with a sub report in it. I have a parameter field in each that handles a date range in that sub report. How do I pass said date range from VB to that sub report? I would guess

    q = Format(dtFrom.Value, "yyyy-mm-dd") & " 00:00:00.000"
    r = Format(dtFrom.Value, "yyyy-mm-dd") & " 00:00:00.000"
    strParm = "date(mgmtprod.rpt); " & q & "," & r & "; TRUE"
    CR.ParameterFields(1) = strParm 'set the parm
    CR.Action = 1

Where dtFrom and dtTo are drop down boxes with dates in them. and date is the paramter name and mgmtprod.rpt is the sub report. When I run this I get invaild parameter name.
0
Comment
Question by:t1clausen
  • 2
4 Comments
 
LVL 7

Expert Comment

by:RainMan82
ID: 16446425
       Dim param1Fileds As New CrystalDecisions.Shared.ParameterFields
        Dim param1Field As New CrystalDecisions.Shared.ParameterField
        Dim param1Range As New CrystalDecisions.Shared.ParameterDiscreteValue

        param1Field.ParameterFieldName = "paraName"                   ' Parameter Name In Crystal Report
        param1Range.Value = Request.QueryString("parameter1")         ' value For Parameter Field
        param1Field.CurrentValues.Add(param1Range)
        param1Fileds.Add(param1Field)                                 ' To add parameter in parameterslist
        CrystalReportViewer1.ParameterFieldInfo = param1Fileds        'to pass parameters to report viewer
        CrystalReportViewer1.ReportSource = Request.QueryString("Path") ' Assign Report Source to the viewer
        CrystalReportViewer1.Visible = True
0
 
LVL 2

Author Comment

by:t1clausen
ID: 16446656
This uses the viewer. I need to use the OCX control. Does this even go for the sub reports?

I tried getting around it by creating a parameter feild in the main report and linking it to the parameter feild in the subreport but that doesn't work either.
0
 
LVL 42

Accepted Solution

by:
frodoman earned 2000 total points
ID: 16446963
I believe you have to pass the parameter to the main report.  For example if you have 2 parameters in the main report and 1 in the subreport then to pass the subreport parameter you would pass:

CR.ParameterFields(3) = strParm  (1 & 2 go to the main report).

0
 
LVL 2

Author Comment

by:t1clausen
ID: 16447676
I think I need to go back to the drawing board and see if I can create a SQL veiw that will get me around createing sub reports. Thanks for the help
0

Featured Post

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.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses
Course of the Month14 days, 12 hours left to enroll

839 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