Linked table manager

F

Frank

Is there no way to link tables in the same folder in such a way that
they will work no matter where they are -- just so they're in the same
folder?

IOW . . .
An Access file links a table in my folder(C:\Documents and
Settings\Frank\My Documents) and I send it to another user who copies
both files into her folder (C:\Documents and Settings\Susan\My
Documents). As long as they're still in the same folder, I'd like it
to find it without having to re-link them.
 
A

Albert D. Kallal

Well, what you want can be done in a round about way:

Here is what you do:

In your startup code, you check if the backend can be opened (just open any
old table that is *supposed* to be linked to the back end, if it can't open,
you simply trap the error).

If the above test fails, then just call your re-linking code, and "pass" it
the name of the current directory where the application is running. Thus, if
the user changes the location, then you will re-link.

You can get the current dir by using the following expression

dim strDB string

strDB = CurrentDb.Name
strDB = Left(strDB, Len(strDB) - Len(Dir(strDB)))

And, if the above fails, then you could then just pop up the file dialog
browse and get the back end name from the user that way.

And, if for some reason you have not yet written you own re-linking
code...you can get it here:
http://www.mvps.org/access/tables/tbl0009.htm

You can also find the file open dialog. So, really, all the code you need to
accomplish what you need is written for you...you just have to cobble it
together. This likely will take less then 30 minutes since all of the code
you need is written already!
 
Top