briana02
August 30th, 2001, 02:17 PM
Hi everyone,
Is there anyway to combine, or query an ADO recordset. I have two recordset objects that are connected to separate Databases. However, I need to combine all the records in one recordset with all the non-repeating data in the other.
Example
Dim adCon1 as ADODB.Connection
Dim adCon2 as ADODB.Connection
Dim rs1 as ADODB.Recordset
Dim rs2 as ADODB.Recordset
'initialize & set all the properties for
'the connections and recordsets...blah blah blah
rs1.Open "SELECT DISTINCT(AgentID) FROM Table_A" _
, adCon1, adOpenForwardOnly, adLockOptimistic, _
adCmdText
rs2.Open "SELECT DISTINCT(AgentID) FROM Table_B" _
, adCon2, adOpenForwardOnly, adLockOptimistic, _
adCmdText
'Now I need to somehow combine all the records
'in rs1 with all the records in rs2 that are
'aren't duplicates(ie don't already exist
'in rs1). We sell under two brand
'names so we have two tables to track sales
'for each brand. However, we now need to
'generate a report of total sales per agent for
'each brand (in case you're wondering why we
'have essentially two of the same tables running
'around...but hey, I didn't design the DB...lol)
Is there anyway to combine, or query an ADO recordset. I have two recordset objects that are connected to separate Databases. However, I need to combine all the records in one recordset with all the non-repeating data in the other.
Example
Dim adCon1 as ADODB.Connection
Dim adCon2 as ADODB.Connection
Dim rs1 as ADODB.Recordset
Dim rs2 as ADODB.Recordset
'initialize & set all the properties for
'the connections and recordsets...blah blah blah
rs1.Open "SELECT DISTINCT(AgentID) FROM Table_A" _
, adCon1, adOpenForwardOnly, adLockOptimistic, _
adCmdText
rs2.Open "SELECT DISTINCT(AgentID) FROM Table_B" _
, adCon2, adOpenForwardOnly, adLockOptimistic, _
adCmdText
'Now I need to somehow combine all the records
'in rs1 with all the records in rs2 that are
'aren't duplicates(ie don't already exist
'in rs1). We sell under two brand
'names so we have two tables to track sales
'for each brand. However, we now need to
'generate a report of total sales per agent for
'each brand (in case you're wondering why we
'have essentially two of the same tables running
'around...but hey, I didn't design the DB...lol)