
Passing parameters to Crystal Report
Hi All,
I have problem setting a Crystal Report parameters in VB6.
Can someone please tell me how to do that?
I tried this:
private sub cmdPrint_Click
rpt1.parameterfield(1) = 'values'
rpt1.action = 1
end sub
** and in crystal report, the parameter 1 name is 'CompanyName' and
type is string.
But There is a runtime error 'Invalid Parameter Field Name' in the (
rpt1.Action=1)
Any help would be appreciated!
Thanks,
Kum
P/S: Below are the sample code from another newgroup, but i don't
understand the statement
Set CrAppl = New CRAXDRT.Application ==> Run time error on this
statement
Sub new_Report ()
Set CrAppl = New CRAXDRT.Application
Set CrRep = CrAppl.OpenReport(szFileName)
CrRep.EnableParameterPrompting = False
SetParameters
CRViewer1.ReportSource = CrRep
end Sub
Sub Setparameters()
Dim cpdefs As CRAXDRT.ParameterFieldDefinitions
Dim cpdef As CRAXDRT.ParameterFieldDefinition
Set cpdefs = CrRep.ParameterFields
For Each cpdef In cpdefs
With cpdef
Select Case .ParameterFieldName
case "CompanyName"
.AddCurrentValue MyTextBoxCompanyName.Text
End Select
End With
Next