"Invalid parameter field name" while passing parameter from VB to CR8.5

Posted on 2005-03-14
Medium Priority
Last Modified: 2007-12-19
im using crystal reports 8.5 and visual basic 6 with MS access as the database.while passing parameter from visual basic to Crystal report i gave the code as below:

  CrystalReport1.ReportFileName = (App.Path & "\report1.rpt")
    CrystalReport1.ParameterFields(0) = Format(dtpfrom.Value, "dd/mm/yyyy")
    CrystalReport1.ParameterFields(1) = dtpto.Value
    CrystalReport1.ParameterFields(2) = cboclient.Text
    CrystalReport1.WindowState = crptMaximized
    CrystalReport1.Action = 1.

Also i have set the correct path and parameter field type in crystal report.even after doing this im getting error
"Invalid parameter field name".

i would like to know where i might have gone wrong.thanks in advance.

Question by:lekshmi_raju
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
  • 2
  • 2
LVL 101

Expert Comment

ID: 13535262
First, I would recommend you consider updating the application to use the RDC rather than continuing with the OCX.  The RDC is much more powerful and provides better control of the reports.  In addition the OCX is not available in CR9.

To fix your specific problem parameters are passed to Crystal in a different way.

Look at

LVL 13

Accepted Solution

vidru earned 375 total points
ID: 13535305
Passing parameter values with the OCX isn't so straightforward, unfortunately.  The format for passing them is this:


ParameterName > is the name of your parameter field
NewValue > is the value you want to pass
SetCurrentValue > Boolean - prompt or don't prompt the user for this parameter

String parameters can be passed this way:

    Report.ParameterFields(0) = "ParamName;Value;true"

Date parameters have to be handled differently:

    Report.ParameterFields (1) = "DateParam;Date(2005,01,21);true"

To see all of the possibilites, you should have a look at this sample:

You can also get the help files for the OCX here:

LVL 101

Expert Comment

ID: 13541048
Thanks dave.  I didn't have access to my OCX code.

LVL 13

Expert Comment

ID: 13541815
If I'd seen your post, I likely wouldn't have hit the Submit button ;)  I must have started typing at about 09:45 AM, then looked at some of my references...


Author Comment

ID: 13581387
thanks to all who helped me..


Featured Post

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

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

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

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