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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to refer to a table in another database using DAO?

Status
Not open for further replies.

vast02

IS-IT--Management
Jul 21, 2005
7
US
I like to refer to a table ("Customers") in another database (db2.mdb) in my C drive using DAO code, how do I do it?

I know if I want to refer to the "Customers" table in current database (db1.mdb), I will use the following code:

Dim rs as Recordset
Dim db as Database

set db = Currentdb()
set rs = db.OpenRecordset("Customers", dbOpenDynaset)

....
(' Above code will get the rs from the current database.)

But now I want to get the recordset from the Customers table in db2.mdb under C drive, instead from my current database. How do I change the code (to replace the CurrentDb() )?

Thank you for help.
 
For some reason, my program can not do this by linking it to db2.mdb. I need to retrieve the rs directly from the db2.

How do I change the CurrentDB() code?

Thanks.
 
I just used Tek-Tips search facility and came up with thread181-1068409


Hope this helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top