Question : My db1 table has a link to db2. Howto use a relative path?

hi
I have 2 db. db1 table has a link to db2.
both db are in "D:\Fava" folder.
the db1 path in db2 linked table properties is: "D:\Fava"
But i want when i copy them (both) to another folder the link works.
how to use relative path?
thanks

Answer : My db1 table has a link to db2. Howto use a relative path?

You have to use the TransferDatabase method to relink it and pass in the Application.Path() value to make it relative to the current path. Something like:

Public Sub Main()

    DoCmd.TransferDatabase acLink, "Microsoft Access", Application.Path & "\" & "MyFile.mdb", acTable, "Customers", "Customers"

End Sub

You will probably want to also use add a line to delete the link before you do the TransferDatabase because if the table is already linked, it will make one named Customers1, Customers2, etc.

M@
Random Solutions  
 
programming4us programming4us