Code will remove all tables in an MS Access database. Make sure to set a reference to the MS DAO 3.
Code will remove all tables in an MS Access database. Make sure to set a reference to the MS DAO 3.6 Object Library.
API Declarations
'in the debugger window.
'all your tables in your database will now be gone!!!!!
Public db As Database
Public rst As Recordset
Public tdf As TableDef
Public tdfs As TableDefs
Rate Code will remove all tables in an MS Access database. Make sure to set a reference to the MS DAO 3.
(2(2 Vote))
Set db = CurrentDb()
Set tdfs = db.TableDefs
For Each tdf In tdfs
If Left(tdf.Name, 4) <> "Msys" Then 'cannot delete system table names
DoCmd.DeleteObject acTable, tdf.Name
End If
Next tdf
tdfs.Refresh
db.Close
MsgBox "All tables have now been deleted!", vbExclamation, "Delete"
Set tdfs = Nothing 'destroy references to objects.
Set db = Nothing
End Sub
Code will remove all tables in an MS Access database. Make sure to set a reference to the MS DAO 3. Comments
No comments yet — be the first to post one!
Post a Comment