Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Relative Paths for Linked Tables?

Status
Not open for further replies.

xanthas12

Programmer
May 23, 2002
4
US
Is there a way to use a relative path for a linked table.
I have 2 databases in the same folder. I need to link to a table in database #2 from database #1. The standard way to link a table will ot work because these tables are part of a web application. When the tables get uploaded to the webserver. The Absolute path that Access assigns to the linked table will not work because it will not be the same there (C:\windoze\blah\data.mdb). Hence the need for a relative path.

Is this possible?...if not any other solutions?

 
Hi!

I can't be sure what will work for you, but this works here(Purdue University). Go to your linked table manager and select all of tables to be linked and go on. When the dialog box opens choose network neighborhood. This gives me a list of zones (probably routers) and I choose the one I need. This gives me a list of network computers(servers in our client/server setup, if you have a peer-to-peer network I assume your computer will show up, if not put your database on a server). Choose the computer where the db resides, follow the directory structure until you find the db and link like normal. Now Access will have a direct path to the db which will use the computers addresses rather than using the virtual drive notations.

hth
Jeff Bridgham
bridgham@purdue.edu
 
Thanks for the reply...
It sounds like your saying to use the UNC path (if not, let me know). Unfortunatley, I cannot use any type of absolute path because I dont know what it is on the web server. (hosted by a third party company)
Picture this...you have an HTML file foo.html which is located in a directory called "stuff". There is an image file boo.gif located in the "images" directory, which is inside the stuff directory. To show the image on the HTML document you link to it by using the following tag:
<img src=&quot;images/boo.gif&quot;>
A relative path. When you link tables thru access it, by default, uses an absolute path to link to the other table. If you were ever to move your table/application you would have to change it to the new environment AND know what the absoulute path (from the root) is to the target database.
UNLESS...there is a way to use an absolute path...
Does this sound acurate or am I missing something???

Thanks,

xanthas12
 
Hi!

Sounds absolutely correct, but this type of problem isn't limited to Access. I think I see that your question is dealing with the two files remaining in the same relative position in the directory structure no matter how they are moved. You can write a function which will delete the existing links and relink the tables based on the location of the front end database(i.e. take the path to the FE Db and add \yourdirectory\yourdb.mdb) and then use the autoexec macro to run this code on opening. I wasn't able to find the exact code I used and I don't remember the exact syntax, but you can probably find a usable solution on this site. The only problem I remember from this is that it is kind of slow when the database is opening.

hth
Jeff Bridgham
bridgham@purdue.edu
 
Is there a System Variable with the current directory path?
I'm a little new to ASP/ACCESS. I come from a UNIX background. In PHP there is a Global Variable $DOCUMENT_ROOT that contains the full root path.

Also, I'm having the same problems with SSIs. Is there a way to use some system variable for the path since it seems to only accept a full root path?

example:
<!-- #Include virtual=&quot;/thisdir/thatdir/mydir/my-inc.asp&quot;-->
 
I figured out the Include file problem:

<!-- #Include file=&quot;my-inc.asp&quot;-->

 
Rather than using linked tables try writing a query like this:

SELECT * FROM table_name IN 'otherdatabase.mdb'

This will let you query a table in another datbase. You can use physical or relative paths.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top