DSmith1965
asked on
Server Has Not Yet Opened
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.LogOnSe rver "p2ssql", "server", "database", "uid", "pwd"
Set crxDatabase = crxReport.Database
Set crxDatabaseTables = crxDatabase.Tables
For Each crxDatabaseTable In crxDatabaseTables
crxDatabaseTable.SetLogOnI nfo "server", "database", "uid", "pwd"
Next crxDatabaseTable
crxReport.ParameterFields. GetItemByN ame("ENTER CONO").Add CurrentVal ue "12"
crxReport.EnableParameterP rompting = False
'Enables the CRViewer's Navigation Controls
ctlCRViewer.EnableNavigati onControls = True
'Disables the CRViewer's Search control
ctlCRViewer.EnableSearchCo ntrol = False
'maximizes the window
'Me.WindowState = 2
'Set the report source
ctlCRViewer.ReportSource = crxReport
'View the report
ctlCRViewer.ViewReport
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(
crxReport.Database.LogOnSe
Set crxDatabase = crxReport.Database
Set crxDatabaseTables = crxDatabase.Tables
For Each crxDatabaseTable In crxDatabaseTables
crxDatabaseTable.SetLogOnI
Next crxDatabaseTable
crxReport.ParameterFields.
crxReport.EnableParameterP
'Enables the CRViewer's Navigation Controls
ctlCRViewer.EnableNavigati
'Disables the CRViewer's Search control
ctlCRViewer.EnableSearchCo
'maximizes the window
'Me.WindowState = 2
'Set the report source
ctlCRViewer.ReportSource = crxReport
'View the report
ctlCRViewer.ViewReport
ASKER
1 - Both databases are on the same server
2 - The error occurs when the report goes to display, the viewer opens up and the message is there.
3 - Tried that didn't seem to make a difference.
2 - The error occurs when the report goes to display, the viewer opens up and the message is there.
3 - Tried that didn't seem to make a difference.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
No, I have an on error goto, and it doesn't go to the sub routine. I gave up and copied the reports to a directory with the same name as the dsn and so when the dsn is passed to the app the, the dsn is stored and used in the .openreport event as part of the path. Thanks for your help, I'm going to give you partial points for responding.
Don
Don
2/ on what line does it error ?
is it <crxReport.ParameterFields
3/ i doubt it will help but to ease reading i try to use
sMyServer = "server"
sMyDB = "database"
sMyUid = "uid"
sMypwd ="pwd"
crxReport.Database.LogOnSe
that way the code is independent of the logons so we can see the code exactly as it will work...