VB+Crystal Report Problem
-
using VB6 and Crystal Report10, Report X contains subreport Y and Z (e.g) When i click button, it gives error as "Query Engin Error 'Error Code: 0x800a0e78' Source Adodb.RecordSet Description: Operation is not allowed when the object is Closed" NOTE: When i use break point and parse line be line, then it works fine. My Code is as: Public Function ShowNELogReport(ByRef rsNELog As ADODB.Recordset, ByRef rsPower As ADODB.Recordset, ByRef rsSystemStatus As ADODB.Recordset, ByRef rsRequirement As ADODB.Recordset) Dim Report As New rptLogMain On Error GoTo Err With rsNELog If Not (.BOF Or .EOF) Then .MoveLast .MoveNext 'Report.Database.SetDataSource rsSearchReport Report.Database.SetDataSource rsNELog Debug.Print Report.Database.Tables.Item(1).Name 'Report.ReadRecords Report.Subreport1.OpenSubreport.Database.SetDataSource rsPower Report.Subreport2.OpenSubreport.Database.SetDataSource rsRequirement Report.Subreport3.OpenSubreport.Database.SetDataSource rsSystemStatus crViewer.ReportSource = Report crViewer.ViewReport Else MsgBox "Record Not Found", vbInformation Unload Me End If End With Exit Function Err: MsgBox Err.Description End Function