Link to home
Start Free TrialLog in
Avatar of Randy Rich
Randy RichFlag for United States of America

asked on

Subscript out of range when calling crystal report from Delphi VCL version 5.5.1

I deploy multiple versions of reports to my customers.  Some of the reports will require certain parameters and others won't.  Here's my problem.  If I add a parameter to one report, I have to add it to all versions of the report regardless of whether they use it.  If I don't and try to run a report using a report source file that doesn't contain it I get Error:116 Subscript out of range :: ParamFields[ paramfield number].  I understand why this is happening, but is there any way I can get around it.  (i.e. if the parameter doesn't exists, just ignore it)

I'm using Crystal 8.5,  Delphi 5 and Delphi VCL version 5.5.1
Avatar of Mike McCracken
Mike McCracken

I don't know what the VCL exposes but I wrote a program in VB6 using the RDC that "knew" the names of the parameters and searched the report for them then assigned values.  So if a parameter didn't exist a value wouldn't be passed even if the application thought one was needed.

You should be able to get at the number of parameters the report requires and I would assume the names.

How does your application just prompt for the parameters?

mlmcc
ASKER CERTIFIED SOLUTION
Avatar of Ephraim Wangoya
Ephraim Wangoya
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Randy Rich

ASKER

Yes, the component was using a paramfields property which was based off of tstringlist and therefore had a count property.  Thanks for the help