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!

how to join records from two recordset with a query?

Status
Not open for further replies.

gmeg1

IS-IT--Management
Oct 2, 2002
14
0
0
IT
Hi,
I have need to create a recordset in which I put all the fields matching from an access table and a sql table.

I opened two recordset one (adomdb) with the records coming from my access database and the other (adosql) with the records coming from a sql table.
The code is:
Set objConnectionmdb = CreateObject("ADODB.Connection")
Set objConnectionsql = CreateObject("ADODB.Connection")
Set adomdb = CreateObject("ADODB.Recordset")
Set adosql = CreateObject("ADODB.Recordset")

objConnectionmdb.Open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=c:\mydatabase.mdb"
adomdb.Open "Select * FROM mytable", objConnectionmdb, 3,3

objConnectionsql.Open "Provider=sqloledb; Network & _
Library=DBMSSOCN ; Data Source=myserver,1433;" & _
"Database=sqldatabase; USER ID=myid ; Password = mypassword"
adosql= .CursorLocation = 3
adosql.Open "Select * FROM mysqltable" ,objConnectionsql,3,3

Now I would like to use these two recordsets to find whic record from both matchs each other.

I do not know if I can create a 3rd recordset using a sql function that joyn the 2 tables.
Is it possible?

Can someone explain me how to do this?

Sorry for my English (I'm not English speaking).

Thank you in advice
 
you might want to add an order by in the sql and access query and then through the results into an array or dictionary, and do a compare on that.

Let me know if this works.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top