Click to See Complete Forum and Search --> : ADO and Crystal Reports


jhemphill
January 26th, 2000, 01:40 PM
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!

DWilliams
January 26th, 2000, 03:04 PM
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, DWilliams@WinningSolutionsInc.com