Accessing Another table using DAO connection

M

mike

Hi all,

I'm trying to find out how I can access a table in another
access database using graphical interface(GUI). I know it
starts with the following code:

Dim Rd As DAO.Database

Set Rd=CurrentDB

If I want to access a table, lets say firstname, in
test.mdb. How do I do it?

Thanks,

mike
 
J

JohnFol

Which is it? Using the GUI or code??

I would suggest you haev a look at the dbEngine(0).OpenDatabase as a
starting point
 
M

mike

By code. Any suggestion?

mike
-----Original Message-----
Which is it? Using the GUI or code??

I would suggest you haev a look at the dbEngine (0).OpenDatabase as a
starting point




.
 
T

TC

(untested)

dim db as database, rs as recordset
set db = dbengine.opendatabase ("C:\test.mdb") ' your path here.
set rs = db.openrecordset ("firstname") ' your table.
if rs.eof then
msgbox "table is empty"
else
msgbox rs.fields(0).name & " = " & rs.fields(0)
endif
set rs = nothing
set db = nothing

P.S. "firstname" is probably not a good name for your table. If it stores
other information about people, eg. their addresses or dates of birth, call
it tblPerson or tblPeople or tblCustomer or somesuch.

HTH,
TC
 
T

TC

Yes. Original poster: this may suit your needs better than the
opendatabase() method.

TC
 
Top