Delete A Linked Table

  • Thread starter Thread starter Tom
  • Start date Start date
This shows how to do it for linked ODBC tables.
Check out "dbAttachedODBC" in Help to see what to use for linked Access
tables.

Public Sub DeleteODBCTableNames()

Dim dbs As Database, tdf As TableDef, I As Integer
Set dbs = CurrentDb
For I = dbs.TableDefs.Count - 1 To 0 Step -1
Set tdf = dbs.TableDefs(I)
If (tdf.Attributes And dbAttachedODBC) Then
dbs.TableDefs.Delete (tdf.Name)
End If
Next I

dbs.Close
Set dbs = Nothing
End Sub
 
Back
Top