G
Gary S
When I run the following code, about half of the
linked tables are deleted. If I run it several times
it eventually gets them all. Why is that??????
Dim db2 As Database
Dim tdf2 As DAO.TableDef
Dim TableType As String
Dim TableName As String
Set db2 = CurrentDb
MsgBox "Total Tables in Current Database: " & db2.TableDefs.Count
For Each tdf2 In db2.TableDefs
TableName = tdf2.Name
TableType = "Regular"
If Left(TableName, 4) = "Msys" Then
TableType = "System"
End If
If tdf2.RecordCount = -1 Then
TableType = "Linked"
End If
If TableType = "Linked" Then
db2.TableDefs.Delete TableName
End If
Next
Set db2 = Nothing
linked tables are deleted. If I run it several times
it eventually gets them all. Why is that??????
Dim db2 As Database
Dim tdf2 As DAO.TableDef
Dim TableType As String
Dim TableName As String
Set db2 = CurrentDb
MsgBox "Total Tables in Current Database: " & db2.TableDefs.Count
For Each tdf2 In db2.TableDefs
TableName = tdf2.Name
TableType = "Regular"
If Left(TableName, 4) = "Msys" Then
TableType = "System"
End If
If tdf2.RecordCount = -1 Then
TableType = "Linked"
End If
If TableType = "Linked" Then
db2.TableDefs.Delete TableName
End If
Next
Set db2 = Nothing