Crydtal Report Parameter Value Problem
I'm trying to add a text field to my report and i get an error.
Error = Invalid Field Name
The name of my textbox = AVGCFS1
Heres My Code
VB Code:
Public SelectDate As String
Dim Report As New CrystalReport1 'your report document
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Try
Dim pval As New ParameterValues
Dim disVal As New ParameterDiscreteValue
disVal.Value = "abc" 'Set the discrete Value
pval.Add(disVal) 'add the parameterdiscretevalue to the collection of parametervalues
Report.DataDefinition.ParameterFields("AVGCFS1").ApplyCurrentValues(pval) 'add the parameter to your report document
If SelectDate = "" Then
CrystalReportViewer1.ReportSource = Report
Else
CrystalReportViewer1.SelectionFormula = "{IntakeData.DateStamp}=" & "'" & SelectDate & "'"
CrystalReportViewer1.ReportSource = Report
End If
Catch ex As Exception
MessageBox.Show(ex.Message, _
"Error.", _
MessageBoxButtons.OK, _
MessageBoxIcon.Error)
End Try
End Sub