The exact code depends on which version of Crystal and how you are executing the report within VB.
I use this code with the Crystal Reports Engine 8 Object Library (CRPEAuto), to set parameters.
VB Code:
'objReport is declared as a CRPEAuto.Report With objReport .ParameterPromptingEnabled = False .ParameterFields(1).SetCurrentValue Trim$(objWard.Ward) .ParameterFields(2).SetCurrentValue dteFrom .ParameterFields(3).SetCurrentValue dteTo End With
and this code is used with the Crystal Reports Designer 8.5 ActiveX Runtime Library (CRAXDRT)
VB Code:
'objReport is declare as CRAXDRT.Report With objReport .EnableParameterPrompting = False .ParameterFields(2).AddCurrentValue Trim$(objWard.Ward) .ParameterFields(2).AddCurrentValue dteFrom .ParameterFields(3).AddCurrentValue dteTo End With
Note that if a parameter value has not been set Crystal will still display its dialog box, even if the ParameterPrompting property is False.




Reply With Quote