lucia
Aug 25th, 2008, 04:22 PM
I have a report connected to server1 at design time. Now I need use this report on different servers. So, I want to set connection to different server(server2, server 3) at run time but I failured.
Here is what I have done.
Dim strSelection As String
'CR9 stuff...
Dim crReport As New CRAXDRT.Report
Dim crApp As New CRAXDRT.Application
strReport = gsTrak & "\Reports\Summary_Report.rpt"
strSelection = "{Summary_Reason.RS_Date} = Date (strDate)
Set crReport = crApp.OpenReport(strReport)
crReport.RecordSelectionFormula = strSelection
crReport.Database.LogOnServer "p2ssql.dll", "Server2", "Trck", "sa", ""
If optPrint(0).value = True Then
' Print to screen
frmCR9Report.ReportFile = strReport
frmCR9Report.SelectionCriteria = strSelection
frmCR9Report.CRV9.ReportSource = crReport
frmCR9Report.CRV9.ViewReport
frmCR9Report.CRV9.DisplayGroupTree = False
frmCR9Report.Show
Else
' Print to printer
crReport.PrintOut False
End If
The red line is newly added. but it didn't do anything. Can anyone help me out? Thanks a lot in advance.
Here is what I have done.
Dim strSelection As String
'CR9 stuff...
Dim crReport As New CRAXDRT.Report
Dim crApp As New CRAXDRT.Application
strReport = gsTrak & "\Reports\Summary_Report.rpt"
strSelection = "{Summary_Reason.RS_Date} = Date (strDate)
Set crReport = crApp.OpenReport(strReport)
crReport.RecordSelectionFormula = strSelection
crReport.Database.LogOnServer "p2ssql.dll", "Server2", "Trck", "sa", ""
If optPrint(0).value = True Then
' Print to screen
frmCR9Report.ReportFile = strReport
frmCR9Report.SelectionCriteria = strSelection
frmCR9Report.CRV9.ReportSource = crReport
frmCR9Report.CRV9.ViewReport
frmCR9Report.CRV9.DisplayGroupTree = False
frmCR9Report.Show
Else
' Print to printer
crReport.PrintOut False
End If
The red line is newly added. but it didn't do anything. Can anyone help me out? Thanks a lot in advance.