Deleting Tables

  • Thread starter Thread starter Guest
  • Start date Start date
Something like the following should work:

Dim dbCurr As DAO.Database
Dim tdfCurr As DAO.TableDef
Dim intLoop As Integer

Set dbCurr = CurrentDb()
For intLoop = (dbCurr.TableDefs.Count - 1) To 1 Step -1
Set tdfCurr = dbCurr.TableDefs(intLoop)
If (tdfCurr.Attributes And dbSystemObject) = 0 Then
If tdfCurr.Name <> "tblTEMPIMPORT" And _
tdfCurr.Name <> "tblSuppliers" Then
dbCurr.TableDefs.Delete tdfCurr.Name
End If
End If
Next intLoop

Set dbCurr = Nothing


(Of course, if there are relationships set up between the tables, you'll
probably run into problems)
 
Back
Top