CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2000
    Location
    Kansas City, MO
    Posts
    34

    ADO and Crystal Reports

    Please help. I am trying to tie a Report Designer Object into active data in a VB application (ADODB.Recordset object) using the CreateFieldDefFile and the SetDataSource methods.
    I can create the Field Definition file all right, but when I try to set the data source to the Recordset I am creating, I get a Runtime error: '9' Subscript out of Range error.
    Has anyone ran into this before? Am I doing something wrong, or missing an important step somewhere? This is my first time w/ Crystal Reports. Please help if you can!

    Old school... six lines a day and I'm done.

  2. #2
    Join Date
    Nov 1999
    Posts
    4

    Re: ADO and Crystal Reports

    Well, im new to it also, but I have gotten it to work without those built in functions... Heres what I have done...

    Dim Report As Report
    Dim applic As Application
    Dim rsGenerate As New ADODB.Recordset
    Dim strResult As String

    Dim reportDb As Database
    Dim reportTables As DatabaseTables
    Dim reportTable As DatabaseTable

    rsGenerate.Open sSQL & " " & sWhere, strConnectString, 1, 2

    Set applic = CreateObject("Crystal.CRPE.Application")
    Set Report = applic.OpenReport(App.Path & "\" & sFileName)

    Set reportDb = Report.Database
    Set reportTables = reportDb.Tables
    Set reportTable = reportTables.Item(1)
    reportTable.SetPrivateData 3, rsGenerate

    Report.Preview


    Any questions, email me, [email protected]


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

Featured