Solved

Access 2007 VBA - Relink database tables from code

Posted on 2011-02-16
2
1,349 Views
Last Modified: 2012-05-11
The Access project I'm working on is divided into two access files, one is the back end that holds all the tables and the data.  The other is the User interface that holds all the forms and reports and imports the tables as linked tables.

If the back end is ever moved then the front end has to relink the tables through the linked table manager.  This application is being built for less savvy computer users and I have a requirement to add functionality to place a button on the main switchboard that will prompt the user for the file location of the back end and update the linked tables.

I've found the following...

http://www.fabalou.com/Access/Modules/refreshtables.asp

which looks like it will work, but I need to have the path before this will be effective.  I would rather not have the user need to type in the path, but rather when they click on the button I would rather have it open an explorer window to have them navigate to and select the file.  I would like to take that path and feed it into this method.

Currently when you go into the Linked Table Manager and relink tables it opens up a file search window for you to navigate to your access file.  I would like to mimic this functionality from a button.

If anyone has a better solution than the way I'm going about this, I would also be open to that.

Thanks
0
Comment
Question by:JosephEricDavis
2 Comments
 
LVL 119

Accepted Solution

by:
Rey Obrero earned 500 total points
ID: 34908005
see this sample db


you can select the file by clicking on the button select file
browse-Q-26825705.mdb
0
 
LVL 7

Author Comment

by:JosephEricDavis
ID: 34908688
Oops, what happens if the access file I'm linking to is password protected?
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now