Solved

Error while setting parameter value through VB6 in Crystal report 8.5

Posted on 2004-08-11
5
463 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
  • 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 50 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

856 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