I'm having problems setting the location of the server in code.
The following code results in the report showing but it still returns records from the database on its original server. Hence the code is not resulting in a change of server. Can anybody help with this issue? Thanks in advance
Sinead
Below is the code I'm using to try to change the server name
Please note that the server name is parking_serv, the database name is ParkByPhone, the userid is sa, and the password is nothing/blank
Dim m_Report As CRAXDDRT.Report
Dim crTable As CRAXDRT.DatabaseTable
Private Sub cmdOpen_Click()
CommonDialog1.CancelError = True
On Error GoTo errHandler
'Display the open dialog box
CommonDialog1.ShowOpen
Set m_Report = Nothing
'Set the report object to nothing
Set m_Report = m_Application.OpenReport(CommonDialog1.FileName, 1)
Set crTable = m_Report.Database.Tables.Item(1)
crTable.SetLogOnInfo "parking_serv","ParkByPhone", "sa ", ""
crTable.Location = "ParkByPhone.dbo.ParkingHist"
'Call DisplayReport to set the report to the Embeddable Designer
'and the Crystal Report Viewer
Call DisplayReport
Public Sub DisplayReport()
'Enable the tab control if disabled.
If SSTab1.Enabled = False Then SSTab1.Enabled = True
'Set the Report Object
CRDesignerCtrl1.ReportObject = m_Report
'Note ----------------
'Set all other properties for CRDesignerCtrl1 after setting the
'ReportObject property
'---------------------
'Set the report source
CRViewer1.ReportSource = m_Report
Set crTable = m_Report.Database.Tables.Item(1)
crTable.SetLogOnInfo "ParkByPhone.dsn", "ParkByPhone", "sa ", ""
crTable.Location = "ParkByPhone.dbo.ParkingHist"
'Set the viewer to view the report
CRViewer1.ViewReport
The following code results in the report showing but it still returns records from the database on its original server. Hence the code is not resulting in a change of server. Can anybody help with this issue? Thanks in advance
Sinead
Below is the code I'm using to try to change the server name
Please note that the server name is parking_serv, the database name is ParkByPhone, the userid is sa, and the password is nothing/blank
Dim m_Report As CRAXDDRT.Report
Dim crTable As CRAXDRT.DatabaseTable
Private Sub cmdOpen_Click()
CommonDialog1.CancelError = True
On Error GoTo errHandler
'Display the open dialog box
CommonDialog1.ShowOpen
Set m_Report = Nothing
'Set the report object to nothing
Set m_Report = m_Application.OpenReport(CommonDialog1.FileName, 1)
Set crTable = m_Report.Database.Tables.Item(1)
crTable.SetLogOnInfo "parking_serv","ParkByPhone", "sa ", ""
crTable.Location = "ParkByPhone.dbo.ParkingHist"
'Call DisplayReport to set the report to the Embeddable Designer
'and the Crystal Report Viewer
Call DisplayReport
Public Sub DisplayReport()
'Enable the tab control if disabled.
If SSTab1.Enabled = False Then SSTab1.Enabled = True
'Set the Report Object
CRDesignerCtrl1.ReportObject = m_Report
'Note ----------------
'Set all other properties for CRDesignerCtrl1 after setting the
'ReportObject property
'---------------------
'Set the report source
CRViewer1.ReportSource = m_Report
Set crTable = m_Report.Database.Tables.Item(1)
crTable.SetLogOnInfo "ParkByPhone.dsn", "ParkByPhone", "sa ", ""
crTable.Location = "ParkByPhone.dbo.ParkingHist"
'Set the viewer to view the report
CRViewer1.ViewReport