title: Crystal Reports pass parameter to sub report using VB.Net
body: <p>I have been trying to pass parameter to crystal report subreport using Vb.Net but failed in every time.</p>
  
  <p>I could successfully pass parameter to main report but not sub report.</p>
  
  <p>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. </p>
  
  <p>Here is my code:</p>
  
  <pre><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)
  </code></pre>
  
  <p>After this peace of code I get a prompt requesting the serviceNo parameter of the sub report.</p>
  
  <p>Would some one paste the proper code to pass same parameter to sub report.</p>