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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to log in to server

Status
Not open for further replies.

mpodlesny

Programmer
Mar 23, 2005
24
US
Crystal Reports Version 8.5
VB 6 sp 5
Oracle 10
I copied this code off this forum. When I run it I get the error "Server not yet opened". How do I open the serve to make the report run?

'Variable declarations
Dim strServerOrDSNName As String
Dim strDBNameOrPath As String
Dim strUserID As String
Dim strPassword As String

Dim i As Integer
Dim j As Integer

strServerOrDSNName = "severname"
strDBNameOrPath = "dbname"
strUserID = "userid"
strPassword = "password"

'Open the report
Set crxRpt = crxApp.OpenReport(App.Path & "\protocol Information.rpt")

'Set the connection for the report.
crxRpt.Database.Tables(1).SetLogOnInfo strServerOrDSNName, strDBNameOrPath, strUserID, strPassword

'This removes the schema from the Database Table's Location property.
Set crxTables = crxRpt.Database.Tables
For Each crxTable In crxTables
With crxTable
.Location = .Name
End With
Next

'Loop through the Report's Sections to find any subreports, and change them as well
Set crxSections = crxRpt.Sections

For i = 1 To crxSections.Count
Set crxSection = crxSections(i)

For j = 1 To crxSection.ReportObjects.Count

If crxSection.ReportObjects(j).Kind = crSubreportObject Then
Set crxSubreportObject = crxSection.ReportObjects(j)

'Open the subreport, and treat like any other report
Set crxSubReport = crxSubreportObject.OpenSubreport
Set crxTables = crxSubReport.Database.Tables

For Each crxTable In crxTables
With crxTable
.SetLogOnInfo strServerOrDSNName, _
strDBNameOrPath, strUserID, strPassword
.Location = .Name
End With
Next

End If

Next j

Next i
'
'View the report
Viewer.ReportSource = crxRpt
Viewer.ViewReport
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top