Jobs
Author: Brandon Date Submitted: 1/3/2007 Category: Database Compatibility: .NET This code has been accessed 6136 times.
Email Yourself this snippet:
'put these declarations in a module and run this stored procedure '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
Code
Sub removetables() 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