Updating linked tables in access

updating linked tables in access-35

This is to make sure that the database always has the latest connection information.

To do this, create a new module and add the following routine: Public Function Ensure Tables Connected() As Boolean Dim db As DAO. Table Def Dim st Backend Db As String Dim st New Backend As String Dim st Not Updated As String Dim i Updated As Integer ' number of tables updated ' get the current database Set db = Current Db() The first thing we want to do is iterate through all the tables in the database so we'll begin a loop.

We're only concerned with linked tables so we'll check the length of the Connect property of the Table Def object in DAO to determine if the table is linked.

Next, we need to refresh the linked table using the Refresh Link method.

If this fails for any reason, we're appending the name of the offending table to a variable called st Not Updated.

Last modified 18-Apr-2016 17:15