Hi! All experts,
I'd like to use VB6 to pass a value to a Crystal Report 7 parameter. The database is Oracle8.
I tried three codes (see (A), (B), (C) below) from other resource, but none of them worked. The run-time error was either "Type mismatch" or "Object does not support this property or method".
Please help!
Thanks in advance!
==============Below is the code =======
Public PcrpReport As CRPEAuto.Report
Public PcrpApplication As New CRPEAuto.Application
.......
Public Sub TestParam()
Dim vVal as string
vRptName = "C:\TestRpt.rpt"
Set PcrpReport = PcrpApplication.OpenReport(vRptName)
PcrpReport.Database.Tables(1).SetLogOnInfo POrcName, POrcInst, PUserStr, PPwd
vVal = "Bill"
'(A)- err: Type mismatch.
PcrpReport.ParameterFields(1) = _
"{?EmployeeName};" & vVal & ";true"
'(B)-err: Object does not support this property or method.
PcrpReport.ParameterFields(1).AddCurrentValue vVal
'(C)-err: Object does not support this property or method.
PcrpReport.ParameterFields.GetItemByName("{?EmployeeName}"
.AddCurrentValue vVal
Call PcrpReport.PrintOut(False)
Set PcrpReport = Nothing
Set PcrpPageOptions = Nothing
End Sub
I'd like to use VB6 to pass a value to a Crystal Report 7 parameter. The database is Oracle8.
I tried three codes (see (A), (B), (C) below) from other resource, but none of them worked. The run-time error was either "Type mismatch" or "Object does not support this property or method".
Please help!
Thanks in advance!
==============Below is the code =======
Public PcrpReport As CRPEAuto.Report
Public PcrpApplication As New CRPEAuto.Application
.......
Public Sub TestParam()
Dim vVal as string
vRptName = "C:\TestRpt.rpt"
Set PcrpReport = PcrpApplication.OpenReport(vRptName)
PcrpReport.Database.Tables(1).SetLogOnInfo POrcName, POrcInst, PUserStr, PPwd
vVal = "Bill"
'(A)- err: Type mismatch.
PcrpReport.ParameterFields(1) = _
"{?EmployeeName};" & vVal & ";true"
'(B)-err: Object does not support this property or method.
PcrpReport.ParameterFields(1).AddCurrentValue vVal
'(C)-err: Object does not support this property or method.
PcrpReport.ParameterFields.GetItemByName("{?EmployeeName}"
Call PcrpReport.PrintOut(False)
Set PcrpReport = Nothing
Set PcrpPageOptions = Nothing
End Sub