Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

passing parameters in subreport

Status
Not open for further replies.

JeffSabat

Programmer
Sep 15, 2003
32
PH
anyone who knows how to pass a parameter value in the subreport... i launch the report in VB.net using reportdocument object.
below is my code in lauching the report with name RptNAme with a parameter ParamName...
my problem is in this report there is a subreport say SubRptName with a parameter SubParamName... everytime i launch the report it asks for values of the subreport...
pls help me...


crReportDocument.Load(strReportPath + RptName)
crReportDocumentSub=crReportDocument.OpenSubreport(SubRptNme)

crParameterFieldDefinitions = crReportDocument.DataDefinition.ParameterFields

crParameterFieldDefinition = crParameterFieldDefinitions.Item(ParamName)

crParameterValues = crParameterFieldDefinition.CurrentValues
crParameterDiscreteValue = New ParameterDiscreteValue
crParameterDiscreteValue.Value = ParamValue
crParameterValues.Add(crParameterDiscreteValue)
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues)

CRV.ReportSource = crReportDocument
 
I believe last time I did this, it treated the parameter as a parameter of the main report, so you would just use the same code, but substitute

crParameterFieldDefinition = crParameterFieldDefinitions.Item(SubParamName)

Note that if the parameters have the same name, you may run into problems.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top