I am changing the database for my CR9 report at runtime using a Visual Basic application and this code:
For x = 1 To REPORTNAME.Database.Tables.Count
With REPORTNAME.Database.Tables(x).ConnectionProperties
.Item("Database" = "DATABASENAME"
.Item("Server" = "SERVERNAME"
.Item("User ID" = "USERID"
.Item("Password" = "PASSWORD"
End With
REPORTNAME.Database.Tables.Item(x).Location = REPORTNAME.Database.Tables.Item(x).Location
The database change is working for the main report, but I need some help in changing the database for the subreports.
I have gotten some responses from this request, but nothing has worked yet. The best answer seems to be with code that looks something like this:
For Each tcSection In REPORTNAME.Sections
For Each tcObj In tcSection.ReportObjects
If tcObj.Kind = crSubreportObject Then
Set tcSubReport = REPORTNAME.OpenSubreport(tcObj.Name)
End If
Next
Next
It took a while to find the correct reference just to get everything declared properly. Now when I run the application, I get an error 'Type Mismatch' within this piece of code (For Each tcSection In REPORTNAME.Sections).
I have been posting this question all over the place and haven't hit paydirt yet. Please Help.
Thanks.
For x = 1 To REPORTNAME.Database.Tables.Count
With REPORTNAME.Database.Tables(x).ConnectionProperties
.Item("Database" = "DATABASENAME"
.Item("Server" = "SERVERNAME"
.Item("User ID" = "USERID"
.Item("Password" = "PASSWORD"
End With
REPORTNAME.Database.Tables.Item(x).Location = REPORTNAME.Database.Tables.Item(x).Location
The database change is working for the main report, but I need some help in changing the database for the subreports.
I have gotten some responses from this request, but nothing has worked yet. The best answer seems to be with code that looks something like this:
For Each tcSection In REPORTNAME.Sections
For Each tcObj In tcSection.ReportObjects
If tcObj.Kind = crSubreportObject Then
Set tcSubReport = REPORTNAME.OpenSubreport(tcObj.Name)
End If
Next
Next
It took a while to find the correct reference just to get everything declared properly. Now when I run the application, I get an error 'Type Mismatch' within this piece of code (For Each tcSection In REPORTNAME.Sections).
I have been posting this question all over the place and haven't hit paydirt yet. Please Help.
Thanks.