Reputation: 26517
How to feeding Crystal Report 8.5 parameters from VB6.0 Application?
Upvotes: 1
Views: 3779
Reputation: 990
here is the way to pass parameters to RPT via CRviewer
Set Report = Appl.OpenReport(App.Path & "MyReport.rpt")
CRViewer1.ReportSource = Report
Report.Database.Tables.Item(1).SetLogOnInfo CnDNS, CnDB, CnUser, CnPwd
Report.EnableParameterPrompting = True
Report.DiscardSavedData
Report.ParameterFields(1).ClearCurrentValueAndRange
Report.ParameterFields(1).AddCurrentValue ParameterValue1
Report.ParameterFields(2).ClearCurrentValueAndRange
Report.ParameterFields(2).AddCurrentValue ParameterValue2
Report.ParameterFields(3).ClearCurrentValueAndRange
Report.ParameterFields(3).AddCurrentValue ParameterValue3
Upvotes: 0
Reputation: 26262
Use the GetItemByName(ByVal Name As String, Optional ByVal SubreportName As Object = Nothing) As CRAXDDRT.ParameterFieldDefinition method. Once you have the ParameterFieldDefinition object, the world is your oyster.
Upvotes: 0
Reputation:
Here is one way of doing it (assuming that crxRpt points to a valid report object):
Dim crxParam as CRAXDRT.ParameterField
For Each crxParam In crxRpt.ParameterFields
Select Case crxParam.Name
Case "{?MyStringParam1}"
crxParam.AddCurrentValue "Parameter1 value"
Case "{?MyNumberParam2}"
crxParam.AddCurrentValue 25.35
End Select
Next crxParam
Upvotes: 1