?
Solved

Error while setting parameter value through VB6 in Crystal report 8.5

Posted on 2004-08-11
5
Medium Priority
?
468 Views
Last Modified: 2008-01-09
Hi

I am using Seagate Crystal Reports 8.5 with VB6. I have the following code:

    Dim adoRsFinal As New ADODB.Recordset
    Dim CRXApplication As New CRAXDRT.Application
    Dim CRXReport As CRAXDRT.Report
    Dim CRXDatabase As CRAXDRT.Database
       
   Set CRXReport = CRXApplication.OpenReport("C:\temp\vickram\rptCompBandsEmployees.rpt", 1)  
   
   adoRsFinal.Open "C:\TEMP\VICKRAM\XML2.xml"  
   
   Set CRXDatabase = CRXReport.Database
   CRXDatabase.SetDataSource adoRsFinal, 3
   
   CRXReport.EnableParameterPrompting = False
   rptCRViewer.ReportSource = CRXReport
   
   CRXReport.ParameterFields.Item(1).Value = 1 <----------- I GET A OBJECT REQUIRED ERROR HERE

The report works fine without the parameters. If I try setting a parameter value, I get a "Object Required" error.

Please help

Thanks
0
Comment
Question by:VICKRAM
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 2

Expert Comment

by:KJHDI12
ID: 11770274

You probably need to add a parameter first using:
CRXReport.ParameterFields.Add

0
 
LVL 13

Author Comment

by:VICKRAM
ID: 11770556
KJHDI12,

I can retrieve the name using

 CRXReport.ParameterFields.Item(1).Name

Then how come value is not working?
0
 
LVL 2

Expert Comment

by:KJHDI12
ID: 11770922

Try this:
CRXReport.ParameterFields(1).SetCurrentValue (1)
0
 
LVL 13

Author Comment

by:VICKRAM
ID: 11771060
There is not such method/property under CRXReport.ParameterFields(1)
0
 
LVL 2

Accepted Solution

by:
KJHDI12 earned 200 total points
ID: 11771330

Check this out:
http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/VB_Databases/Q_20671705.html

They are discussing exactly what your having prolems with.

[form.]Report.ParameterFields(ArrayIndex)[="ParameterName;NewValue;SetCurrentValue"]
SetCurrentValue can be TRUE or FALSE
sale_purchase.ParameterFields(0) = "parameter0;your_string;TRUE"


0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month11 days, 14 hours left to enroll

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question