rhubarbtwo
asked on
Active Data Report creation for ado recordset
I'm wanting to pass an ado recordset to the crystal engine from vb6.
From an article at http://support.seagatesoftware.com/library/kbase/articles/c2002389.asp I shuld be able to do this with the vb code below. But an article at http://support.seagatesoftware.com/library/kbase/articles/c2002616.asp explains that to avoid an error the report must be an active data report which uses the active data driver.
My question is, how do you create an active data report?
I have tried File|New|Custom>>> which gives the 'DataFile' option, but it seems to require either an ado connection string or ODBC DSN, where as I want to define the report so that I can pass the rs at runtime.
There's also the dictionary option which i tried some time ago.
VB code:
Dim crpApplication As CRPEAuto.Application
Dim crpReport As CRPEAuto.Report
Dim crpDatabase As CRPEAuto.Database
Dim crpTables As CRPEAuto.DatabaseTables
Dim crpTable As CRPEAuto.DatabaseTable
Set crpApplication = CreateObject("crystal.crpe .applicati on")
Set crpReport = crpApplication.OpenReport( App.Path & "\test.rpt")
Set crpDatabase = crpReport.Database
Set crpTables = crpDatabase.Tables
Set crpTable = crpTables.Item(1)
I then pass the report an ado recordset as follows:
Call crpTable.SetPrivateData(3, adoRS)
crpReport.Preview
From an article at http://support.seagatesoftware.com/library/kbase/articles/c2002389.asp I shuld be able to do this with the vb code below. But an article at http://support.seagatesoftware.com/library/kbase/articles/c2002616.asp explains that to avoid an error the report must be an active data report which uses the active data driver.
My question is, how do you create an active data report?
I have tried File|New|Custom>>> which gives the 'DataFile' option, but it seems to require either an ado connection string or ODBC DSN, where as I want to define the report so that I can pass the rs at runtime.
There's also the dictionary option which i tried some time ago.
VB code:
Dim crpApplication As CRPEAuto.Application
Dim crpReport As CRPEAuto.Report
Dim crpDatabase As CRPEAuto.Database
Dim crpTables As CRPEAuto.DatabaseTables
Dim crpTable As CRPEAuto.DatabaseTable
Set crpApplication = CreateObject("crystal.crpe
Set crpReport = crpApplication.OpenReport(
Set crpDatabase = crpReport.Database
Set crpTables = crpDatabase.Tables
Set crpTable = crpTables.Item(1)
I then pass the report an ado recordset as follows:
Call crpTable.SetPrivateData(3,
crpReport.Preview
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I'm not sure I understand.
I have found that most of my reports can be boiled down into a single recordset of data pulled from a variety of related tables. I do this with SQL/ADO in VB or with a view on SQL Server and base my report off that one dataset. Using CRW Groups and sections you can then get that report laid out pretty much however you want. Most of my reports don't even have an active detail section - it is suppressed, and all the real stuff goes into group footers.
It is possbile, according to seagate, to use more than one TTX when designing a report. I tried to get it working and couldn't in the time I had.
I have found that most of my reports can be boiled down into a single recordset of data pulled from a variety of related tables. I do this with SQL/ADO in VB or with a view on SQL Server and base my report off that one dataset. Using CRW Groups and sections you can then get that report laid out pretty much however you want. Most of my reports don't even have an active detail section - it is suppressed, and all the real stuff goes into group footers.
It is possbile, according to seagate, to use more than one TTX when designing a report. I tried to get it working and couldn't in the time I had.
ASKER
I think one rs will be enough for me (I was confusing myself I think), but I was interested in your last para to your last comment though.
ASKER