DAO from one DB to another? (1 Viewer)

Access_guy49

Registered User.
Local time
Today, 10:33
Joined
Sep 7, 2007
Messages
462
Hey everyone!
Ok i'm still sorta new to the DAO stuff, so hopefully this question isn't too stupid but i'm trying to connect to a database on a network, from a database on a local machine.

I want to search for a specific record on this network db.

If anyone can point me in the right direction, i would be very greatful.

I am currently familure with the basic setup of DAO where i create recordsets within a local database. (just to give an idea of my knowledge)
 
Last edited:

LPurvis

AWF VIP
Local time
Today, 15:33
Joined
Jun 16, 2008
Messages
1,269
Hello.

OK - typos are easy with such similar TLA's. (Three Letter Acronyms ;-)
Are we talking about DAO or ADO? :)

Assuming DAO (as you mention it twice to ADO's single occurance) - you can open a database object to the target file and then query it - or use your existing connection to your running application, and query externally.
Very quickly:

Dim db as DAO.Database
Dim rst as DAO.Recordset

Set db = OpenDatabase("X:\Data\MyFile.mdb")
Set rst = db.OpenRecordset("SELECT * FROM TableName WHERE FieldID = 1")
etc...

Or just
Dim rst as DAO.Recordset
Set rst = CurrentDb.OpenRecordset("SELECT * FROM [X:\Data\MyFile.mdb].TableName WHERE FieldID = 1")

Bearing in mind that the most common solution would be just to create a linked table to the other database and query it as normal.

Cheers.
 

Access_guy49

Registered User.
Local time
Today, 10:33
Joined
Sep 7, 2007
Messages
462
OK - typos are easy with such similar TLA's. (Three Letter Acronyms ;-)
Are we talking about DAO or ADO? :)

ADO? what do you mean ADO! lol... i'm just kidding, i went back and fixed it. Thanks!
Also, thanks for your fast reply and help
 

Users who are viewing this thread

Top Bottom