Is there a way to make a Linked Table path relative ?

J

John

I would like to reference tables in another .mdb database in the same
folder. I would also like the option of moving the folder to other
locations. The path stored in Access for linked tables is the full and
complete path, resulting in the links being broken if the folder is
moved. Is there a way to make the path relative, i.e. ".\data.mdb" ?

Please respond to the list. Thank you.

John
 
A

Albert D. Kallal

No, you can' to use relative paths.

On the other hand, you can simply have your application check if the link to
a back table is present, if it is, then everything is ok.

If the link is NOT ok, then you simply attempt to re-link, and the first
place your code can try is the current dir.

So, in effect, if the database is moved, then it can run as normal without
user interaction. Hence, at the end of the day, you can't use relative
paths, but since it can re-link at startup...then you get the same effect
(and users can move the database to different locations)

You can use the code here to re-link.

http://www.mvps.org/access/tables/tbl0009.htm
 
W

Wayne Morgan

As can be seen by this immediate window test:

currentdb.TableDefs("Absence1").Connect = ";DATABASE=.\db3.mdb"
currentdb.TableDefs("Absence1").RefreshLink
?currentdb.TableDefs("Absence1").Connect
;DATABASE=C:\Documents and Settings\Wayne\Desktop\db3.mdb

Access will accept the ".", but then expands it out to the full path. This
leaves you with relinking the tables in code.

http://www.mvps.org/access/tables/tbl0009.htm
 

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

Top