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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing parameter values to subreport

Status
Not open for further replies.

stroyer74

IS-IT--Management
Jan 22, 2003
70
US
I am using VB.NET 2003 and am trying to pass parameter values to a subreport. I am able to pass values to the main report with no problems, but I am not sure of the syntax to get it to go to the subreport. Any suggestions?

The section of code listed below works for adding the parameter for the main report, but if I use the same method for adding the subreport, I get the standard Crystal parameter selection window indicating that I did not provide a needed parameter for the subreport.



Mainform parameters:
Parameter1
Subform parameters:
Parameter2

***CODE***
Dim crReportDocument As New ReportDocument
crReportDocument.Load(frmStartup.strReportName)

Dim crParameterValues As ParameterValues
Dim crParameterDiscreteValue As ParameterDiscreteValue
Dim crParameterFieldDefinitions As ParameterFieldDefinitions
Dim crParameterFieldLocation As ParameterFieldDefinition

crParameterFieldDefinitions = crReportDocument.DataDefinition.ParameterFields
crParameterFieldLocation = crParameterFieldDefinitions.Item("Parameter1")
crParameterValues = crParameterFieldLocation.CurrentValues
crParameterDiscreteValue = New CrystalDecisions.Shared.ParameterDiscreteValue
crParameterDiscreteValue.Value = "TEST"
crParameterValues.Add(crParameterDiscreteValue)
crParameterFieldLocation.ApplyCurrentValues(crParameterValues)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top