PDA

Click to See Complete Forum and Search --> : connect to server at run time(CR9,Sql 2000,Vb6)


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.

Hack
Aug 26th, 2008, 08:39 AM
Does it produce an error or just not do anything at all?

lucia
Aug 26th, 2008, 08:55 AM
Does it produce an error or just not do anything at all?
Thanks, Hack.
No error, and do nothing.

Hack
Aug 26th, 2008, 09:05 AM
Given that I don't know what p2ssql.dll does (I can only guess), I really can't point to anything specific.

You said you wanted to try different servers....is the result that same no matter what server you try?

lucia
Aug 26th, 2008, 09:16 AM
Given that I don't know what p2ssql.dll does (I can only guess), I really can't point to anything specific.

You said you wanted to try different servers....is the result that same no matter what server you try?

You are right. the result is the same no matter what server I connected.