I have a problem with a report which has 2 subreports.
When I try to run it from vb6 I get "Server has not yet been opened" error message.
The data is retrieved using SQL stored 3 stored procedures.
one for the main report and 1 for each of the sub reports.
the code that I am using in vb for the MAIN REPORT IS:
Set crxReport = crxApplication.OpenReport(RptName)
With crxReport
For Each dt In .Database.Tables
.VerifyOnEveryPrint = False
.DiscardSavedData
searchfor = "."
Location = CStr(dt.Location)
occurance = InStr(Location, searchfor)
sublocation = Mid(Location, occurance, Len(Location) - occurance + 1)
Location = frmLogin.dbname & sublocation
dt.SetTableLocation Location, "", ""
dt.SetLogOnInfo frmLogin.DBServer, frmLogin.dbname, frmLogin.DBSQLId, frmLogin.DBSQLPassword
Next
End With
FOR SUB REPORTS:
If (subreport <> ""
Then
Dim subrep() As String
subrep = Split(subreport, ","
Dim x As Integer
For x = 0 To UBound(subrep)
'Set mySub = crxReport.OpenSubreport(subreport)
Set mySub = crxReport.OpenSubreport(subrep(x))
With mySub
For Each dt In .Database.Tables
.VerifyOnEveryPrint = False
.DiscardSavedData
searchfor = "."
Location = CStr(dt.Location)
occurance = InStr(Location, searchfor)
sublocation = Mid(Location, occurance, Len(Location) - occurance + 1)
Location = frmLogin.dbname & sublocation
dt.SetTableLocation Location, "", ""
.Database.SetDataSource crxReport
'dt.SetLogOnInfo frmLogin.DBServer, frmLogin.dbname, frmLogin.DBSQLId, frmLogin.DBSQLPassword
dt.SetLogOnInfo frmLogin.DBServer, frmLogin.dbname, "gh", "gh"
'sleep (3)
'dt.SetLogOnInfo frmLogin.DBServer, frmLogin.dbname
Next
End With
'tmrTimer.Index
'tmrTimer.Interval
Next
End If
What it seeams to me is happening is that the sub report logon data is not getting refreshed.
Thanks for any help
Pawel
When I try to run it from vb6 I get "Server has not yet been opened" error message.
The data is retrieved using SQL stored 3 stored procedures.
one for the main report and 1 for each of the sub reports.
the code that I am using in vb for the MAIN REPORT IS:
Set crxReport = crxApplication.OpenReport(RptName)
With crxReport
For Each dt In .Database.Tables
.VerifyOnEveryPrint = False
.DiscardSavedData
searchfor = "."
Location = CStr(dt.Location)
occurance = InStr(Location, searchfor)
sublocation = Mid(Location, occurance, Len(Location) - occurance + 1)
Location = frmLogin.dbname & sublocation
dt.SetTableLocation Location, "", ""
dt.SetLogOnInfo frmLogin.DBServer, frmLogin.dbname, frmLogin.DBSQLId, frmLogin.DBSQLPassword
Next
End With
FOR SUB REPORTS:
If (subreport <> ""
Dim subrep() As String
subrep = Split(subreport, ","
Dim x As Integer
For x = 0 To UBound(subrep)
'Set mySub = crxReport.OpenSubreport(subreport)
Set mySub = crxReport.OpenSubreport(subrep(x))
With mySub
For Each dt In .Database.Tables
.VerifyOnEveryPrint = False
.DiscardSavedData
searchfor = "."
Location = CStr(dt.Location)
occurance = InStr(Location, searchfor)
sublocation = Mid(Location, occurance, Len(Location) - occurance + 1)
Location = frmLogin.dbname & sublocation
dt.SetTableLocation Location, "", ""
.Database.SetDataSource crxReport
'dt.SetLogOnInfo frmLogin.DBServer, frmLogin.dbname, frmLogin.DBSQLId, frmLogin.DBSQLPassword
dt.SetLogOnInfo frmLogin.DBServer, frmLogin.dbname, "gh", "gh"
'sleep (3)
'dt.SetLogOnInfo frmLogin.DBServer, frmLogin.dbname
Next
End With
'tmrTimer.Index
'tmrTimer.Interval
Next
End If
What it seeams to me is happening is that the sub report logon data is not getting refreshed.
Thanks for any help
Pawel