My report is is written using the Active driver and in the VB program I call it from I open a connection to an Access database, create a recordset, then point the report at the recordset. Finally I close the resordset and connection. My problem is that the connection never really closes until I end the program. I'm using the ActiveX control. Here's the code:
Dim cn As New ADODB.Connection, rsData As New ADODB.Recordset
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\CorSupt.mdb;"
rsData.Open "SELECT * FROM CorSupt WHERE CorSupt.LetterType='" & strLetterNumber & _
"' AND CorSupt.RecordDate=#" & strReportDate & "#", cn
With CrystalReport1
.ReportFileName = App.Path & "\" & strReportName & "p.rpt"
.SetTablePrivateData 0, 3, rsData
.Destination = crptToPrinter
.PrinterStopPage = 0
.Action = 1
.SetTablePrivateData 0, 3, Nothing
End With
rsData.Close
cn.Close
Any ideas how I can get it to drop the connection would be greatly appreciated.
Dim cn As New ADODB.Connection, rsData As New ADODB.Recordset
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\CorSupt.mdb;"
rsData.Open "SELECT * FROM CorSupt WHERE CorSupt.LetterType='" & strLetterNumber & _
"' AND CorSupt.RecordDate=#" & strReportDate & "#", cn
With CrystalReport1
.ReportFileName = App.Path & "\" & strReportName & "p.rpt"
.SetTablePrivateData 0, 3, rsData
.Destination = crptToPrinter
.PrinterStopPage = 0
.Action = 1
.SetTablePrivateData 0, 3, Nothing
End With
rsData.Close
cn.Close
Any ideas how I can get it to drop the connection would be greatly appreciated.