About Link Table

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi everyone

When we link the tables from another database file, we can check the path of
the linked table from the link table manager. I want to know if we can use a
filename instead of the full path of that linked file?

For example, if my file is located in C:\db and the filename is db.mdb, then
the path would become C:\db\db.mdb, that means if the database is moved to
another folder or even another computer, the path will become invalid and i
have to renew the path. So do you if it is possible to set the path with the
filename only but not the full path?

Thanks.

Chris
 
No. Access does not support a partial path or relative path in the Connect
property of the TableDef.
 
Further to what Allen's said, while Access only works with full paths, you
can add code to your application so that it checks whether the tables are
linked correctly, and relinks them if they're not.

If you're using Access 2000 or newer, you can find out where your current
application is using CurrentProject.Path. With Access 97 or older, use
Left$(CurrentDb.Name, Len(CurrentDb.Name) - Len(Dir(CurrentDb.Name)))

That means you should be able to build your path dynamically.

See http://www.mvps.org/access/tables/tbl0009.htm at "The Access Web" for
one approach to relinking. You'd want to change the section of code that
determines strNewPath from what's there, but otherwise it should be what you
need.
 
Thanks all!

Douglas J. Steele said:
Further to what Allen's said, while Access only works with full paths, you
can add code to your application so that it checks whether the tables are
linked correctly, and relinks them if they're not.

If you're using Access 2000 or newer, you can find out where your current
application is using CurrentProject.Path. With Access 97 or older, use
Left$(CurrentDb.Name, Len(CurrentDb.Name) - Len(Dir(CurrentDb.Name)))

That means you should be able to build your path dynamically.

See http://www.mvps.org/access/tables/tbl0009.htm at "The Access Web" for
one approach to relinking. You'd want to change the section of code that
determines strNewPath from what's there, but otherwise it should be what you
need.
 

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

Back
Top