Skip to Content
avatar image
Former Member

Passing an (on demand) ADO recordset to a subreport ?


Development applications I use are Visual Basic 6.0 SP6 and Crystal Reports XI R2.

Googleing the internet, Iu2019ve found document with examples regarding using TTX files and

passing an ADO recordset to a subreport using RDC or Crystal Automation Server:

Although that document was Crystal Reports 8 related, I guess itu2019s partially or even totally applicable to CR XI procedures.

Both examples show how to pass a recordset to a subreport at startup i.e. when subreport datau2019s known in advance,

but is there a way to pass a recordset to a subreport u201Con demandu201D ?

Example: main report is a list of buyers and subreport is a list of items selected buyer purchased last month. If a report user clicks some buyer, I should query database and pass a query result to a subreport.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Sep 04, 2008 at 01:45 PM

    Not sure if I understand the question completely. Do you mean to say that the list the user selects; apple, orange, pear has no place holder in the subreport? E.G.; you are trying to essentially build the report / subreport on the fly (in other words, report creation APIs)?


    Add comment
    10|10000 characters needed characters exceeded

    • Unfortunately you will not be able to do this in any easy way. Through our SDK the subreport object you get is template subreport; you cannot get the individual instance of the currently printing subreport.

      I can think of only one way you might accomplish this. If you know that there are going to be just say five fields in the subreport, what you could do is create a User Function Library (UFL - com based dll) with five functions in it. Then in the subreport create five formulas to return the value of those functions.

      On the OnDrill event you could then save the data of the five fields "some where" that your UFL functions then could pick up and pass back to the subreport formulas. This is not elegant, though it may work.

      You can find a thread on UFLs here: