Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Server has not yet been opened.

Status
Not open for further replies.

Hetzer

Programmer
May 15, 2001
1
US
I am trying to write a generic VB application to display Crystal reports with parameters. I can get it to display the a report with stored data but get "Server has not yet been opened" when I resubmit the report. I am using RDC. I have looked at the Automation Server but this requires additional coding to pass the parameters to the reports. Do I have to use the Automation Server to accomplish this?

Option Explicit
Dim m_Application As New CRAXDDRT.Application
Dim m_Report As New CRAXDDRT.Report
'Dim m_Application As New CRPEAuto.Application
'Dim m_Report As New CRPEAuto.Report
'Dim m_Report As New CrystalReport1
Dim datacmd1 As ADODB.Command
Dim i As Integer



'DisplayReport is a procedure that
' - Sets the report object to the Crystal Report Viewer Control
Public Sub DisplayReport()

Screen.MousePointer = vbHourglass

CRViewer1.ReportSource = m_Report

' Set the viewer to view the report
CRViewer1.ViewReport
' Set the zoom level to fit the page
' to the width of the viewer window
CRViewer1.Zoom 1
Screen.MousePointer = vbDefault

End Sub


Private Sub cmdOpenReport_Click()
CommonDialog1.CancelError = True

On Error GoTo errHandler

'Display the open dialog box
CommonDialog1.ShowOpen

' Build the ADO connection string
'strConnectString = "Provider=MSDAORA;Data Source=prod" + _
' ";User ID=userid;Password=password"

'If OpenConnection() = False Then
' MsgBox "Unable to Logon", , "Logon Failed"
'End If

'Set the report object to nothing
Set m_Report = Nothing

'Set m_Application = CreateObject("Crystal.CRPE.Application")
'Open the selected report

Set m_Report = m_Application.OpenReport(CommonDialog1.FileName, 1)

'm_Report.Preview ("Hercules")

' m_Report.Database.Tables(1).SetDataSource rsRecordSet, 3

'm_Report.Database.Tables(1).SetLogOnInfo "", "", "", "userPassword"
'm_Report.Database.Tables(1).SetLogOnInfo "lawsonprod", "prod", "userid", "password"
'm_Report.Database.LogOnServer "pdsodbc.dll", "prod.world", "prod", "Lawsonprod", "Mustangs"

Call DisplayReport

Set m_Report = Nothing
Set m_Application = Nothing

Exit Sub

errHandler:
'User cancalled dialog

End Sub

 
Remove the CRPEAuto references. Choose one method to connect to the database, either .SetLogonInfo or .LogonServer (right now they are both commented out).

For .LogonServer:

m_Report.Database.LogOnServer "p2sodbc.dll", "prod.world", "prod", "Lawsonprod", "Mustangs"

I use p2sodbc.dll.
prod.world is the DSN or server name.
prod is the name of the db.
Lawsonprod is the username and Mustangs is the password.
Brian J. Alves
Terrier Consulting, Inc.
Email: brian.alves@worldnet.att.net
VB / Crystal / SQLServer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top