Allow table linking in MS Access based on relative paths

G

Guest

Requiring absoulte path means that I cannot develop and test an application
on a machine with different directories

----------------
This post is a suggestion for Microsoft, and Microsoft responds to the
suggestions with the most votes. To vote for this suggestion, click the "I
Agree" button in the message pane. If you do not see the button, follow this
link to open the suggestion in the Microsoft Web-based Newsreader and then
click "I Agree" in the message pane.

http://www.microsoft.com/office/com...fd8f1&dg=microsoft.public.access.externaldata
 
G

Guest

Absolute paths are not required. You can use UNC paths. In any network
environment, that is the way it is done.
 
G

Guest

1. I did not find any place where I could enter/edit the path. I show Access
where the file is and it picks the path. I only can view it with the linked
files manager.

2. As I understand, UNC paths are absolute paths as well. I would like to
have relative paths. i.e. 'same directory' or 'parent directory'.
 
G

Guest

True, all paths are absolute. You don't have to let Access pick the path.
You can enter the UNC path in the Link dialog. You can also edit the path in
the Linked Table Manager.

As to same path or parent path, I am not sure what you mean by that.
 
G

Guest

1. The link dialog is just a file open dialog. So what I enter here will be
resolved in much the same way as if I had navigated to the same file.

2. I cannot detect any way to edit the file in the linked table manager. I
only get a prompt leading to the same dialog as in 1. To avoid any confusion
I should mention that I am using Access 2002/XP.

3. By 'same/parent dir' I was referring to the usual syntax of relative paths
* anotherdb1.mdb is a file in the same directory as the mdb where
this link is specified
* ..\anotherdb2.mdb is a file in the parent directory of the mdb
where this link is specified
 
G

Guest

NumberNine said:
1. The link dialog is just a file open dialog. So what I enter here will be
resolved in much the same way as if I had navigated to the same file.
Not true. If you type in a UNC path, that is how the link will be stored.
2. I cannot detect any way to edit the file in the linked table manager. I
only get a prompt leading to the same dialog as in 1. To avoid any confusion
I should mention that I am using Access 2002/XP.
It hasn't changed since '97. In the lower left hand corner of the Linked
Table Manager dialog there is check box that says "Always Prompt for New
Location". You can check that. When you click OK, you will get a file open
dialog. Type in the UNC path just as you would when you first link.
3. By 'same/parent dir' I was referring to the usual syntax of relative paths
* anotherdb1.mdb is a file in the same directory as the mdb where
this link is specified
* ..\anotherdb2.mdb is a file in the parent directory of the mdb
where this link is specified

The only time access uses relative paths is when search for library databases.
And to help you with the linking issue, here is the basic technique for
relinking programmatically:

For Each tdf In dbs.TableDefs

If Len(tdf.Connect) > 0 Then
' Its a linked table. Re-link

tdf.Connect = ";database=" & Me.datapath
tdf.RefreshLink
End If
Next tdf
 
G

Guest

Looks interesting. I'll check this out tomorrow when I have more time.

Thanks for swhowing me these links.
 
G

Guest

Klatuu said:
Not true. If you type in a UNC path, that is how the link will be stored.

I still do not see how this helps. As I understand the UNC path allows to
specify a mapped drive without knowing the eventual drive letter, but not to
specify a relative path.
It hasn't changed since '97. In the lower left hand corner of the Linked
Table Manager dialog there is check box that says "Always Prompt for New
Location". You can check that. When you click OK, you will get a file open
dialog. Type in the UNC path just as you would when you first link.

This does not solve the problem. I want to hand over a pair of database
files to the users instructing them: 'Put these in any directory, no matter
where, only both in the same and it will work without any further measures'.
And to help you with the linking issue, here is the basic technique for
relinking programmatically:
For Each tdf In dbs.TableDefs

If Len(tdf.Connect) > 0 Then
' Its a linked table. Re-link

tdf.Connect = ";database=" & Me.datapath
tdf.RefreshLink
End If
Next tdf

This may help for standalone DBs that are opened within MS-Acess, because
then you could put this code in an autostart routine (at least I think so).

I have doubts whether this is a good decision for DBs accessed
programmatically, because this seems to be DAO code that would have to be
incorporated into my code. And I understand that Microsoft declared DAO to be
obsolete.

And sorry for the long delay.
 

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