Accessing Another table using DAO connection

  • Thread starter Thread starter mike
  • Start date Start date
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
 
Which is it? Using the GUI or code??

I would suggest you haev a look at the dbEngine(0).OpenDatabase as a
starting point
 
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




.
 
(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
 
Back
Top