crystal reports 8.5 continues
-
Hi, this is how i open a report inside VB6 Sub CreateReport(SQL As String, MyConnection As Connection, ReportPath As String, _ ReportTitle As String, OpenMethod As Integer) Dim crApp As New CRAXDRT.Application Dim crRep As New CRAXDRT.Report Dim Rs As New ADODB.Recordset On Error GoTo Err_Proc With Rs .CursorLocation = adUseClient .Open SQL, MyConnection, adOpenKeyset, adLockReadOnly .ActiveConnection = Nothing If .RecordCount > 0 Then Set crRep = crApp.OpenReport(ReportPath, OpenMethod) crRep.Database.SetDataSource Rs ' crRep.Database.LogOnServer "C:\SUKI\Support\crystal\Pdlsql.dll", gStrServer, gStrDatabase crRep.ReportTitle = ReportTitle With frmReportViewer .Caption = crRep.ReportTitle .WindowState = vbMaximized .CRViewer.ReportSource = crRep If OpenMethod = 0 Then 'print directly to printer crRep.PrintOut False, 1, True Else .CRViewer.ViewReport '1=show print layout to user .Show vbModal End If End With Else MsgBox "Record(s) not found.", vbExclamation, App.Title End If .Close End With Set Rs = Nothing Set crRep = Nothing Set crApp = Nothing Exit Sub Err_Proc: Call ErrMsg End Sub Am i forgetting something cause my report is not working. "physical database not found" is always its error. geboy
-
Hi, this is how i open a report inside VB6 Sub CreateReport(SQL As String, MyConnection As Connection, ReportPath As String, _ ReportTitle As String, OpenMethod As Integer) Dim crApp As New CRAXDRT.Application Dim crRep As New CRAXDRT.Report Dim Rs As New ADODB.Recordset On Error GoTo Err_Proc With Rs .CursorLocation = adUseClient .Open SQL, MyConnection, adOpenKeyset, adLockReadOnly .ActiveConnection = Nothing If .RecordCount > 0 Then Set crRep = crApp.OpenReport(ReportPath, OpenMethod) crRep.Database.SetDataSource Rs ' crRep.Database.LogOnServer "C:\SUKI\Support\crystal\Pdlsql.dll", gStrServer, gStrDatabase crRep.ReportTitle = ReportTitle With frmReportViewer .Caption = crRep.ReportTitle .WindowState = vbMaximized .CRViewer.ReportSource = crRep If OpenMethod = 0 Then 'print directly to printer crRep.PrintOut False, 1, True Else .CRViewer.ViewReport '1=show print layout to user .Show vbModal End If End With Else MsgBox "Record(s) not found.", vbExclamation, App.Title End If .Close End With Set Rs = Nothing Set crRep = Nothing Set crApp = Nothing Exit Sub Err_Proc: Call ErrMsg End Sub Am i forgetting something cause my report is not working. "physical database not found" is always its error. geboy
Hi If you remove the line .ActiveConnection = Nothing then you problem may get solved
Tushar kothari