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

Posted on 2011-05-03
Last Modified: 2012-05-11
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
Question by:Randy Rich
    LVL 100

    Expert Comment

    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?

    LVL 32

    Accepted Solution


    I dont use Crystal Reports but generally in delphi, objects that implement some kind of Parameter list normally have methods for searching parameters



    also check for a Count property

    Author Closing Comment

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

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    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…
    Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    734 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

    19 Experts available now in Live!

    Get 1:1 Help Now