I have an Oracle table query that the resulting Recordset could be used in three further queries. Is there a way to reference the first Recordset in another query that also pulls data from Oracle tables.
Example:
Dim Cmd1, Cmd2 As ADODB.Command
Set Cmd1 = New ADODB.Command
Set Cmd1.ActiveConnection = MyConn
Cmd1.CommandType = adCmdText
Cmd1.CommandText = "Select * from Tbl1 where product=abc"
Set Rs1 = Cmd1.Execute()
Set Cmd2 = New ADODB.Command
Set Cmd2.ActiveConnection = MyConn
Cmd2.CommandType = adCmdText
Cmd2.CommandText = "Select * from Rs1, Tbl2 where Rs1.product=Rs2.product"
Set Rs2 = Cmd2.Execute()
I am using Excel 2013 and accessing Oracle tables using InstantClient 11.2. Connecting to the Oracle tables is not an issue, nor is returning the first recordset, but when I attempt the second query I get Run-time error '-2147217865 (80040e37': Automation error.
As I have used this sight to solve many problems, your insights are greatly appreciated!
BMitch
Example:
Dim Cmd1, Cmd2 As ADODB.Command
Set Cmd1 = New ADODB.Command
Set Cmd1.ActiveConnection = MyConn
Cmd1.CommandType = adCmdText
Cmd1.CommandText = "Select * from Tbl1 where product=abc"
Set Rs1 = Cmd1.Execute()
Set Cmd2 = New ADODB.Command
Set Cmd2.ActiveConnection = MyConn
Cmd2.CommandType = adCmdText
Cmd2.CommandText = "Select * from Rs1, Tbl2 where Rs1.product=Rs2.product"
Set Rs2 = Cmd2.Execute()
I am using Excel 2013 and accessing Oracle tables using InstantClient 11.2. Connecting to the Oracle tables is not an issue, nor is returning the first recordset, but when I attempt the second query I get Run-time error '-2147217865 (80040e37': Automation error.
As I have used this sight to solve many problems, your insights are greatly appreciated!
BMitch