How to link to a table in another DB through code

  • Thread starter Thread starter Mota
  • Start date Start date
M

Mota

Hi;
In a SQL statement i have to inner join to a table in another DB.So i have
to make a link to this table first,to make it available.
Supposing this DB is in the path : "E:\My DataBase\UpdatingDB.mdb" ,What is
the code that makes the table "RequestsTBL" in this database available to
the "C:\PrescPro\PrescriptionProcessor.mdb" that is my current Front End
Database that im coding into?
Thank you in advance for your help.
 
Mota said:
In a SQL statement i have to inner join to a table in another DB.So i have
to make a link to this table first,to make it available.
Supposing this DB is in the path : "E:\My DataBase\UpdatingDB.mdb" ,What is
the code that makes the table "RequestsTBL" in this database available to
the "C:\PrescPro\PrescriptionProcessor.mdb" that is my current Front End
Database that im coding into?


You can use CreateTableDef() and assign the path to the
TableDef's Connect property or use TransferDatabase.

But you do not actually need a linked table just to run a
query against another mdb file. Take a look at SQL Help
(table of contents) for an explanation of the IN phrase.

SELECT somefields
FROM tbl1 INNER JOIN tbl2 IN "the path"
ON tbl1.key1field = tbl2.key2field
. . .
 
So,in this case,i dont need to create a tableDef or even import it thru
TransferDataBase.Is it true?
thank you for ur help.
 
Mota said:
So,in this case,i dont need to create a tableDef or even import it thru
TransferDataBase.Is it true?

It sounds like that may be all you need, but I don't know
exactly what you're application is doing. Check Help and
give it a try in a test mdb to see if it works for you.
--
Marsh
MVP [MS Access]


 
Ok,
Thank you so much for ur help.

Marshall Barton said:
Mota said:
So,in this case,i dont need to create a tableDef or even import it thru
TransferDataBase.Is it true?

It sounds like that may be all you need, but I don't know
exactly what you're application is doing. Check Help and
give it a try in a test mdb to see if it works for you.
--
Marsh
MVP [MS Access]


 
Back
Top