Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Error while setting parameter value through VB6 in Crystal report 8.5

Posted on 2004-08-11
5
Medium Priority
?
470 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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…
Suggested Courses

604 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