Hi,
Good day. I have a crystal report design that consist of 1 parameter. I am written a code that try to pass in the value to Crystal Report so that it will display the report according to what i want.
However, it does not seems to be display the records that i want, but it just ignore my parameter and show all the records.
Here is my code:
__________________________________________________________
Private
Sub frmPreview_Load(sender As Object, e As System.EventArgs)
Handles Me.Load
Dim cryRpt As New ReportDocument
cryRpt.Load(“C:\\Dynamics\Reports\Report1.rpt”)
Try
Dim crParameterFieldDefinitions As ParameterFieldDefinitions
Dim crParameterFieldDefinition As ParameterFieldDefinition
Dim crParameterValues As
New ParameterValues
Dim crParameterDiscreteValue As New ParameterDiscreteValue
crParameterDiscreteValue.Value = "15"
crParameterFieldDefinitions = cryRpt.DataDefinition.ParameterFields
crParameterFieldDefinition = crParameterFieldDefinitions.Item("ACTINDX")
crParameterValues = crParameterFieldDefinition.CurrentValues
crParameterValues.Clear()
crParameterValues.Add(crParameterDiscreteValue)
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues)
cryRpt.ParameterFields(0).CurrentValues = crParameterValues
CrystalReportViewer1.ReportSource = cryRpt
CrystalReportViewer1.Refresh()
End Sub
________________________________________________________________
Can anyone please help? Thanks.