Find the path of the linked tables in Access with VBA

These days I happened to analyze many Access 2003 and 2007 databases with many linked tables. I needed to identify the source database for each linked table and therefore the path, the system tables and the tables of each database.

Here is a script in vba that performs this service, create a module in an access file and insert the following lines of code in the database to be analyzed, inserting the Immediate Window in the VBA environment (View> Immediate Window):



Sub Estrai_Tabelle() Dim db As DAO.Database Dim obj As DAO.TableDef Dim intContaTabella As Integer Set db = CurrentDb() intcontaTabelle = 0 For Each obj In db.TableDefs intcontaTabelle = intcontaTabelle + 1 Debug.Print Right("00000" + CStr(intcontaTabelle), 5) + _ " - " + obj.Name + " " _ ; String(CStr(100 - Len(Trim(obj.Name))), "-") If Left(obj.Name, 4) = "MSys" Then Debug.Print "Tabella di sistema" Else Debug.Print "Tabella collegata da elaborare" Debug.Print "stringa connessione = " + obj.Connect; "" End If 'crea una riga vuota per dare più spazio Debug.Print Next obj Set obj = Nothing Set db = Nothing End Sub



add a comment of Find the path of the linked tables in Access with VBA
Comment sent successfully! We will review it in the next few hours.