D
Debbie
Hello,
I have A2003 using a front end and back end configuration which works just
fine. However, I have a need to pull data from another back end database.
Essentially, the tables are linked from 2 seperate back end databases.
In a procedure, I run two different queries. One goes against one backend
database#1 and the other goes against backend database#2.
The query against backend#1 works fine. When a run a query against
backend#2, I get a message saying the table from the backend#2 can't be
found. A sample of my code is below. :
Dim OConn As ADODB.Connection
Dim SQL As String
Dim SQLCmd As ADODB.Command
Dim MasterOConn As ADODB.Connection
Set OConn = New ADODB.Connection
Set OConn = OpenConn()
Set MasterOConn = New ADODB.Connection
Set MasterOConn = OpenConnMaster()
Set SQLCmd = New ADODB.Command
SQLCmd.ActiveConnection = OConn
.....
SQL = "INSERT INTO LogConsultation ......
SQLCmd.CommandText = SQL
SQLCmd.Execute
SQL = ""
****The query below produces the error saying Consulation1 could not be
found.
'Refresh the rows
SQL = "INSERT INTO Consultation ...
SQL = SQL & " SELECT Consultation1.ClientID, ....
SQL = SQL & " FROM Consultation1 WHERE ClientId = " &
rstClientList!ClientID
SQLCmd.ActiveConnection = MasterOConn
SQLCmd.CommandText = SQL
SQLCmd.Execute
SQL = ""
I am using the same connection and the same SQL command with the 2nd query
as with the first. Is this allowed? I checked the connection statement and
it is fine. Does anyone have any ideas? Thanks so much.
Debbie
I have A2003 using a front end and back end configuration which works just
fine. However, I have a need to pull data from another back end database.
Essentially, the tables are linked from 2 seperate back end databases.
In a procedure, I run two different queries. One goes against one backend
database#1 and the other goes against backend database#2.
The query against backend#1 works fine. When a run a query against
backend#2, I get a message saying the table from the backend#2 can't be
found. A sample of my code is below. :
Dim OConn As ADODB.Connection
Dim SQL As String
Dim SQLCmd As ADODB.Command
Dim MasterOConn As ADODB.Connection
Set OConn = New ADODB.Connection
Set OConn = OpenConn()
Set MasterOConn = New ADODB.Connection
Set MasterOConn = OpenConnMaster()
Set SQLCmd = New ADODB.Command
SQLCmd.ActiveConnection = OConn
.....
SQL = "INSERT INTO LogConsultation ......
SQLCmd.CommandText = SQL
SQLCmd.Execute
SQL = ""
****The query below produces the error saying Consulation1 could not be
found.
'Refresh the rows
SQL = "INSERT INTO Consultation ...
SQL = SQL & " SELECT Consultation1.ClientID, ....
SQL = SQL & " FROM Consultation1 WHERE ClientId = " &
rstClientList!ClientID
SQLCmd.ActiveConnection = MasterOConn
SQLCmd.CommandText = SQL
SQLCmd.Execute
SQL = ""
I am using the same connection and the same SQL command with the 2nd query
as with the first. Is this allowed? I checked the connection statement and
it is fine. Does anyone have any ideas? Thanks so much.
Debbie