Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB sample (.vbp) how to pass parameter to CR ?

Status
Not open for further replies.

gabster

Programmer
Oct 23, 2001
192
0
0
US
Hi

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.)

Thank you,
Gabi.
 
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

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top