Article ID: 154397 - View products that this article applies to.
This article was previously published under Q154397
This article has been archived. It is offered "as is" and will no longer be updated.
Advanced: Requires expert coding, interoperability, and multiuser skills.
The RefreshTableLinks module in the Developer Solutions sample application (Solutions.mdb) demonstrates a method of updating the connection information for linked (attached) tables in an application that uses multiple databases.
This article describes how you can modify the functions used in the modRefreshTableLinks module (or RefreshTableLinks module in Solutions.mdb for Microsoft Access 7.0) to work in a run-time environment.
This article assumes that you are familiar with Visual Basic for Applications and with creating Microsoft Access applications using the programming tools provided with Microsoft Access. For more information about Visual Basic for Applications, please refer to your version of the "Building Applications with Microsoft Access" manual.
To modify the functions used in the modRefreshTableLinks module to work in a run-time environment, follow these steps while running the retail version of Microsoft Access. Each of these steps is described in detail in the following sections.
Step 1Import the modRefreshTableLinks Module from Solutions.mdb:
Step 2Follow these steps to modify the CheckLinks() function to test if the path of your current attachments are correct:
Step 3Follow these steps to modify the FindNorthwind() function to display the Open File dialog box for the user to locate your back-end database. The function returns the full path to the back-end database:
Step 4Follow these steps to modify the RelinkTables() function to look for a table in your linked database and replace references to Northwind.mdb and Solutions.mdb with references to your application:
Step 5Call the ReLinkTables() Function from your SwitchBoard's Load event or in your application's AutoExec Macro.
In the Developer Solutions sample application, the ReLinkTables() function is called from the DeveloperSolutions (or Solutions in Microsoft Access 7.0) form's Load event. This function determines whether the table attachments are valid. If the attachments are not valid, the function prompts the user for the location of the linked tables. The ReLinkTables() function could also be called from your AutoExec macro. The command you would add to the Switchboard's Load event is:
The AutoExec macro entries are as follows:
Condition Action ------------------------------------------- NOT CheckLinks() RunCode Action Arguments ----------------------------- RunCode Function Name: RelinkTables()
Contact us for more help