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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top