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

Passing parameter from vb to cr9

Status
Not open for further replies.

ter79

IS-IT--Management
Jul 11, 2001
106
US
I'm using VB6 with CR9, I have a report that has a parameter that I'm trying to pass from vb. This is the code that I'm using but it keeps giving me an error stating that subscript is out of range.

The report is in the VB project as a Designer.



CrystalReport2.DiscardSavedData
CrystalReport2.PrinterSetup frmMain.hwnd
CrystalReport2.PrinterDuplex = crPRDPVertical
CrystalReport2.ParameterFields(0) = "PledgeNum;" & VBPledgeFieldNum & ";True"
CrystalReport2.PrintOut False, 1, False

Any help is appreciated. Thanks in advance
 
Change
CrystalReport2.ParameterFields(0)

to
CrystalReport2.ParameterFields(1)

Cheers,
- Ido

CUT, Visual CUT, and DataLink Viewer:
view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
I'm getting a different error message now.

Run time error '438'

Object doesn't support this property or method.

I did change parameterfield(0) to parameterfield(1)

Any other ideas?
 
Looks like you're trying to use the old OCX syntax to pass the parameter. Try it like this (which works for CR 8.5, and should for 9.0 as well):

CrystalReport2.ParameterFields(1).AddCurrentValue VBPledgeFieldNum

or

CrystalReport2.ParameterFields.GetItemByName("PledgeNum").AddCurrentValue VBPledgeFieldNum
-dave
 
Thanks. The second one was the one that worked...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top