I have a VB6 application that prints a CR Report. I have created a database table in SQL Server 2000 that is used only for field mapping/formatting.
I created the bound fields in the report from the table, and I create a recordset from the table (empty).
Then I add records to the recordset within the program from stored objects and set the datasource of the report to the recordset.
When I try to view the report i get the error: "ODBC error: [Microsoft][ODBC Driver Manager] Connection Not Open"
Here is the code that I use:
Code:
dim iRS as ADODB.Recordset
set iRS = [DataConnect object].GetDisconnectedRecordset("SELECT * FROM tblItemsReportFormat") '--this function just returns a disconnected recordset from the already connected datasource within the program
dim oRpt as CRRptLouver '-- the CR Report
set oRpt = new CRRptLouver
dim crItems as CRAXDDRT.Report
set crItems = oRpt.OpenSubreport("rptItems")
crItems.Database.SetDataSource iRS,3,1
dim rptForm as frmReport
set rptForm = new frmReport
rptForm.CRViewer1.ReportSource = oRpt
rptForm.CRViewer1.ViewReport '-- Here is where the error occurs
rptForm.Show