Solved

Error while setting parameter value through VB6 in Crystal report 8.5

Posted on 2004-08-11
5
458 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
Comment Utility

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

0
 
LVL 13

Author Comment

by:VICKRAM
Comment Utility
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
Comment Utility

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

Author Comment

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

Accepted Solution

by:
KJHDI12 earned 50 total points
Comment Utility

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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

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 Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

744 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now