Solved

Error while setting parameter value through VB6 in Crystal report 8.5

Posted on 2004-08-11
5
461 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SSRS expression Issue finding a string 10 65
Put text in a picture ASP.NET C# 2 50
Run code from text file in vb 1 56
Getting warning: You are about to delete 1 row(s) 9 43
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

911 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

16 Experts available now in Live!

Get 1:1 Help Now