Results 1 to 4 of 4

Thread: record sets

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Sep 2002
    Posts
    779

    record sets

    Does anybody now how to create a report using a record set instead of a database.

  2. #2
    Lively Member
    Join Date
    Jul 2001
    Location
    New Hampshire, USA
    Posts
    127
    Are you using Crystal Reports? If so, you can use a data definition file (.ttx). Once you define the data structure, you can use vb code to pass a recordset to the report and display it. If you are using Crystal Reports, let me know, and i'll give you some more specifics.
    Andrew Divers

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Sep 2002
    Posts
    779
    Yes, i'm using Crystal Reports.

  4. #4
    Lively Member
    Join Date
    Jul 2001
    Location
    New Hampshire, USA
    Posts
    127
    Im just going by memory here so my details may not be exact.

    In crystal reports, if you hit Add Database... choose Other Data Sources, Active Data Sources, Definitions Only - No Data (I believe that is right). This will allow you to create a ttx file to define your recordset.

    Once you have defined your structure...

    Before your CrystalReports1.PrintReport or CrystalReports1.ACTION = 1, do a

    CrystalReports1.SetPrivateTable 1, rsYourRecordSet, 3

    The 1 is telling the report that the recordset you are passing it is for the 1st defined database in the report. I don't remember what the 3 does, but anytime I have done this, it has been a 3.

    So basically your code would be something like this...

    Dim RS as adodb.recordset

    set RS = new adodb.recordset

    rs.open "SELECT * FROM tblTABLE", objConnection

    crystalreports1.setprivatetable 1, RS, 3
    crystalreports1.printreport

    I don't have CR on this computer, so I can't check that, but it should give you enough to work with.
    Andrew Divers

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width