• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 725
  • Last Modified:

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

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.

lekshmi
0
lekshmi_raju
Asked:
lekshmi_raju
  • 2
  • 2
1 Solution
 
mlmccCommented:
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
http://support.businessobjects.com/communityCS/FilesAndUpdates/SCR_VB_OCX_Parameter.exe.asp

mlmcc
0
 
vidruCommented:
Passing parameter values with the OCX isn't so straightforward, unfortunately.  The format for passing them is this:

Report.ParameterFields(ArrayIndex)[=ParameterName;NewValue;SetCurrentValue]

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:
http://support.businessobjects.com/communityCS/FilesAndUpdates/scr_vb_ocx_parameter.exe.asp

You can also get the help files for the OCX here:
http://support.businessobjects.com/communityCS/FilesAndUpdates/SCR_OCX_Help.exe.asp

-dave
0
 
mlmccCommented:
Thanks dave.  I didn't have access to my OCX code.

mlmcc
0
 
vidruCommented:
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...

-dave
0
 
lekshmi_rajuAuthor Commented:
thanks to all who helped me..

regards
lekshmi
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now