Re-Linking tables w/Relative path

R

Rick

Hi,
I have an Access 2k app I am deploying which has a front
end backend design, but there are some "local" back end
tables that sit on the users workstation. All of the
front end and local backend files are contained within one
folder. By default, the front end looks for these local
back end tables in the C:\myfoldername directory.
However, some users may need to put their folder in the H:
or G: drive. The only way I know to re-establish the
links is to have them run the Linked Table manager. I'd
like to automate a proceedure so they don't have to do
anything at all. I've been told Access doesn't use
relative paths (which would work great in this scenario)
and I was pointed to a code sample at an mvp site that is
supposed to check to see if links are established, but
even that code prompts users to choose a location. Any
thoughts? Thanks,
-Rick
 
J

John Nurick

Hi Rick,

I've done this in the past by modifying the code from the MVPs site so
it

1) checks whether the current links are valid
2) if not, tries to link to a back end mdb in the same
folder as the front end (extracting the path from
CurrentDB.Name)
3) if that fails, prompt the user.
 
R

Rick

Thanks. On number 2, could you point me in the right
direction on how to extract the name from the
currentdb.name? I think this would work. Thanks again,
-Rick
-----Original Message-----
Hi Rick,

I've done this in the past by modifying the code from the MVPs site so
it

1) checks whether the current links are valid
2) if not, tries to link to a back end mdb in the same
folder as the front end (extracting the path from
CurrentDB.Name)
3) if that fails, prompt the user.



Hi,
I have an Access 2k app I am deploying which has a front
end backend design, but there are some "local" back end
tables that sit on the users workstation. All of the
front end and local backend files are contained within one
folder. By default, the front end looks for these local
back end tables in the C:\myfoldername directory.
However, some users may need to put their folder in the H:
or G: drive. The only way I know to re-establish the
links is to have them run the Linked Table manager. I'd
like to automate a proceedure so they don't have to do
anything at all. I've been told Access doesn't use
relative paths (which would work great in this scenario)
and I was pointed to a code sample at an mvp site that is
supposed to check to see if links are established, but
even that code prompts users to choose a location. Any
thoughts? Thanks,
-Rick

--
John Nurick [Microsoft Access MVP]

Please respond in the newgroup and not by email.
.
 
D

Douglas J. Steele

The path can be determined as Left$(CurrentDb.Name, Len(CurrentDb.Name) -
Len(Dir$(CurrentDb.Name)))

In Access 2000 and up, you can also use CurrentProject.Path

--
Doug Steele, Microsoft Access MVP

(No private e-mails, please)



Rick said:
Thanks. On number 2, could you point me in the right
direction on how to extract the name from the
currentdb.name? I think this would work. Thanks again,
-Rick
-----Original Message-----
Hi Rick,

I've done this in the past by modifying the code from the MVPs site so
it

1) checks whether the current links are valid
2) if not, tries to link to a back end mdb in the same
folder as the front end (extracting the path from
CurrentDB.Name)
3) if that fails, prompt the user.



Hi,
I have an Access 2k app I am deploying which has a front
end backend design, but there are some "local" back end
tables that sit on the users workstation. All of the
front end and local backend files are contained within one
folder. By default, the front end looks for these local
back end tables in the C:\myfoldername directory.
However, some users may need to put their folder in the H:
or G: drive. The only way I know to re-establish the
links is to have them run the Linked Table manager. I'd
like to automate a proceedure so they don't have to do
anything at all. I've been told Access doesn't use
relative paths (which would work great in this scenario)
and I was pointed to a code sample at an mvp site that is
supposed to check to see if links are established, but
even that code prompts users to choose a location. Any
thoughts? Thanks,
-Rick

--
John Nurick [Microsoft Access MVP]

Please respond in the newgroup and not by email.
.
 
B

Bruce M. Thompson

Thanks. On number 2, could you point me in the right
direction on how to extract the name from the
currentdb.name? I think this would work. Thanks again,

To extract just the database *name* in any version of Access, you can use:

Dir(CurrentDb.Name)

.... Or, in Access 2000 and later ...

CurrentProject.Name

If you really meant the *path*, Doug Steele has provided you with that
information in his post.
 
A

Armen Stein

Hi,
I have an Access 2k app I am deploying which has a front
end backend design, but there are some "local" back end
tables that sit on the users workstation. All of the
front end and local backend files are contained within one
folder. By default, the front end looks for these local
back end tables in the C:\myfoldername directory.
However, some users may need to put their folder in the H:
or G: drive. The only way I know to re-establish the
links is to have them run the Linked Table manager. I'd
like to automate a proceedure so they don't have to do
anything at all. I've been told Access doesn't use
relative paths (which would work great in this scenario)
and I was pointed to a code sample at an mvp site that is
supposed to check to see if links are established, but
even that code prompts users to choose a location. Any
thoughts? Thanks,
-Rick

Hi Rick,

We have a relinking utility that we offer to other developers at a
nominal cost. It automatically relinks to multiple Access back-end
databases, prompting if necessary, and also has a feature that
automatically relinks to a back-end database in the application's folder
if it exists there. We've used it in hundreds of projects, and I think
it may do what you want.

If you are interested, please contact me via email.
 

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