I'm trying to pass an ado recordset to a report which has fields from an associated data definition
I've made the following declarations in my code:
Public adoCon As New ADODB.Connection
Public adoRS As New ADODB.Recordset
Public crpApp As CRAXDRT.Application
Public crpReport As CRAXDRT.Report
Dim sDocPath As String
I've opened an ado con and an ado rs then....
sDocPath = App.Path & "\report1.rpt"
Set crpApp = New CRAXDRT.Application
'OR Set crpApp = CreateObject("CrystalRuntime.Application")
'Set crpReport = New CRAXDRT.Report '=> illegal op
Set crpReport = crpApp.OpenReport(sDocPath)
crpReport.Database.Tables(1).SetDataSource adoRS, 3
'OR crpReport.Database.Tables.Item(1).SetDataSource adoRS, 3
.CRViewer1.ReportSource = crpReport
But all I get in the report at runtime is the one line of sample data in the ttx file.
If I remove the comment from set crpReport = new CRAXDRT then vb causes an illegal op and crashes.
A sample on Planet Source Code uses a Crystal Designer instead of a CRAXDRT.Report. For some reason
I can get this sample code to display my adoRS data in the viewer using my rpt which is linked to a
ttx, but not using the above code. So there can't be too much wrong with my report and ttx file.
The CR Developer help for SetDataSource says that the SetDataSource method can be invoked only in formatting Idle mode, I was wondering if this had anything to do with the problem.
I'm sure the problem must be a simple one, the code seems to be ok when compared with other examples, is there a setting I've missed?
Can anyone email me a simple working sample vb project using CR version 8?