Code to ck for existing link to ext db tbl

C

CT

I am looking for code to check for an existing link to an
external database table. Or method to delete a table from
external database (probably better option).

I am really trying to empty a linked table. I tried a
delete query but number of records did not make it
practical.

CT
 
C

CT

Will this work??

Dim db2 As Database
Dim tdf As TableDef
Dim strTEST As String
strTEST = "MASTER DATABANK.mdb"
Set db2 = CurrentDb()
db2.TableDefs.Refresh
For Each tdf In db2.TableDefs
With tdf
If Len(.Connect) > 0 Then
.SourceTableName = .Name 'Source/link
same table name
.Connect = "; DATABASE=" & strTEST
.RefreshLink
End If
End With
Set tdf = Nothing
Set db2 = Nothing
 
Top