{"id":860,"date":"2012-08-03T16:23:00","date_gmt":"2012-08-03T08:23:00","guid":{"rendered":"http:\/\/vm-officeblogs.cloudapp.net\/2012\/08\/03\/automatically-relink-microsoft-access-tables\/"},"modified":"2022-07-26T06:13:04","modified_gmt":"2022-07-26T13:13:04","slug":"automatically-relink-microsoft-access-tables","status":"publish","type":"post","link":"https:\/\/www.microsoft.com\/en-us\/microsoft-365\/blog\/2012\/08\/03\/automatically-relink-microsoft-access-tables\/","title":{"rendered":"Automatically relink Microsoft Access tables"},"content":{"rendered":"

\"Relinking(Guest blogger Patrick Wood, an Access MVP, is the founder of <\/i>Gaining Access Technologies<\/i>, a software company specializing in working with SQL Azure and Access. He also founded <\/i>Microsoft Access and SQL Azure Information Cente<\/i>r for developers. For more information, contact <\/i>patwood@gainingaccess.net<\/a>)<\/p>\n

In this article we will show you how you can call a single procedure using just a little code to automatically relink your back-end tables, even when the database files have been moved to a different folder. The procedure will also relink the tables in multiple back-ends. And best of all, you don’t have to know much about writing code to make this work.<\/p>\n

Automating the relinking of tables just makes good sense. This is especially true if you are distributing your database to others. It can save you a lot of headaches, trouble, travel, and time. You do not have to be physically present, nor do you need to remotely access another computer. Additionally, you do not have to enter the names of your back end database(s) or your linked tables.<\/p>\n

How does it work?<\/h3>\n

The code gets important information from the TableDefs<\/b> collection in your front-end. This includes the names of your linked tables and the names of your back-end databases. The code then uses this information along with the existing path of the front-end database to get the string needed to set the TableDef Connect Property<\/b>. The code loops through the TableDefs Collection<\/b> and uses the TableDef RefreshLink Method<\/b> to Refresh<\/b> the links.<\/p>\n

Here is what the code will do:<\/p>\n