Does anyone have or know of a vbp project sample of how to pass a custom
parameter to a crystal report? By "custom parameter" I mean passing a
parameter from a VB form (ex. a drop down box or a text field, etc.)
Here is a snippet that I use to pass parameter values. Hope it helps.
dim appCr As CRAXDRT.Application
dim repForm As CRAXDRT.Report
Dim crxParamDefs As CRAXDRT.ParameterFieldDefinitions
Dim crxParam As CRAXDRT.ParameterFieldDefinition
dim Parameter1Value, Parameter2Value 'dim to match the parameter type
Parameter1Value=value from your control (eg, txtP.text)
Parameter2Value=value from your control2
sRPTpath = path to rpt file
Set repForm = appCr.OpenReport(sRPTpath,
Set crxParamDefs = repForm.ParameterFields
For Each crxParam In crxParamDefs
With crxParam
Select Case .ParameterFieldName
Case "Parameter1"
.AddCurrentValue Parameter1Value
Case "Parameter2"
.AddCurrentValue Parameter2Value
End Select
End With
Next
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.