I have been trying to pass parameter to crystal report subreport using Vb.Net but failed in every time.
I could successfully pass parameter to main report but not sub report.
Main report contains master information about an employee and the sub report has detailed info about his academic qualifications. All linked using serviceNo of type int. I have parameter in both reports called serviceNo.
Here is my code:
Dim frmReport As New frmReport
Dim repDoc As New ReportDocument
Dim crParameterFieldDefinitions As ParameterFieldDefinitions
Dim crParameterFieldDefinition As ParameterFieldDefinition
Dim crParameterValues As New ParameterValues
Dim crParameterDiscreteValue As New ParameterDiscreteValue
crParameterDiscreteValue.Value = serviceNo
crParameterFieldDefinitions = repDoc.DataDefinition.ParameterFields
crParameterFieldDefinition = crParameterFieldDefinitions.Item("serviceNo")
crParameterValues = crParameterFieldDefinition.CurrentValues
crParameterValues.Clear()
crParameterValues.Add(crParameterDiscreteValue)
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues)
After this peace of code I get a prompt requesting the serviceNo parameter of the sub report.
Would some one paste the proper code to pass same parameter to sub report.