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 Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

pass value to Crystal Report 7 parameter using VB6

Status
Not open for further replies.

mingichu

MIS
Apr 12, 2002
29
US
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top