Server Has Not Yet Opened
Posted on 2007-08-06
I have a report that I want to run against different identical databases. The report was created in crystal 8.5, and I am using a viewer created in VB6 to view the reports. Because it is an old app, and I need to do this quick upgrading it to .net is not an option right now. When I run the viewer it works fine and the report displays. But, when I run the viewer pointing to the second database I get the Server Has Not Yet Opened error. I'm also running against a SQL server. When it logs onto the tables it loops the correct number of times so I know part of it is working.
Below is my code and it is in a private sub routine.
Dim crxApplication As New CRAXDRT.Application
Dim crxReport As New CRAXDRT.Report
Dim crxDatabase As CRAXDRT.Database
Dim crxDatabaseTables As CRAXDRT.DatabaseTables
Dim crxDatabaseTable As CRAXDRT.DatabaseTable
Dim crxApplication As
On Error GoTo errorhandler
' Make the CRViewer visible
ctlCRViewer.Visible = True
'Set the report object
Set crxReport = crxApplication.OpenReport(App.Path & "\chart.rpt")
crxReport.Database.LogOnServer "p2ssql", "server", "database", "uid", "pwd"
Set crxDatabase = crxReport.Database
Set crxDatabaseTables = crxDatabase.Tables
For Each crxDatabaseTable In crxDatabaseTables
crxDatabaseTable.SetLogOnInfo "server", "database", "uid", "pwd"
crxReport.EnableParameterPrompting = False
'Enables the CRViewer's Navigation Controls
ctlCRViewer.EnableNavigationControls = True
'Disables the CRViewer's Search control
ctlCRViewer.EnableSearchControl = False
'maximizes the window
'Me.WindowState = 2
'Set the report source
ctlCRViewer.ReportSource = crxReport
'View the report