Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Importing Subreports with different Database Names not working

Status
Not open for further replies.

mgreer

Programmer
Jan 9, 2001
45
0
0
US
I'm trying to import several subreports into a main report. I woule like each subreport connects to a different database. Even though I set the logon info correctly the subreports all show data from the first subreport imported. For example:

session("oRpt").Sections.Item("RH").ImportSubreport "C:\Inetpub\ 0, 0
'Now open the subreport. "client" is the name of the subreport.
Set CRSubreport = session("oRpt").OpenSubreport("client1.rpt")
' Each table must use SetLogonInfo to logon.
' And logon to the datasource
set crtablesub = CRSubreport.Database.Tables.Item(1)
crtablesub.SetLogonInfo <servername1>, <databaseName1>, <username>, <password>


Session(&quot;oRpt&quot;).Sections.Item(&quot;PH&quot;).ImportSubreport &quot;C:\Inetpub\ 0, 0
'Now open the subreport. &quot;client&quot; is the name of the subreport.
Set CRSubreport2 = session(&quot;oRpt&quot;).OpenSubreport(&quot;client2.rpt&quot;)
' Each table must use SetLogonInfo to logon.
' And logon to the datasource
set crtablesub2 = CRSubreport2.Database.Tables.Item(1)
crtablesub2.SetLogonInfo <serverName1>, <databaseName2>, <username>, <password>


When I view the report the second subreport has info from databaseName1 instead of databaseName2? How do I get it to display data from a different database?

NOTE: When I change the second subreport ServerName to a different Server the report works. Each subreport pulls data from the correct db. This only fails when trying to access several databases on the same server.

Any ideas?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top