Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Deleting all tables 1

Status
Not open for further replies.

jtp02

Instructor
Jul 11, 2002
1
FI
How could be done code that would delete/remove all current tables in Access?

I have database where all tables are imported. After I finish working, I would like that all visible tables would be deleted or removed (excluded hidden and systemtables).

Thanks, Jtp02
 
Call the following code from a "Delete All Talbes" button or similar.

Public Sub DeleteTables()
Dim tdf As TableDef
For Each tdf In CurrentDb.TableDefs
If Not Left(tdf.Name, 4) = "MSys" Then ' Don't delete System Tables
DoCmd.DeleteObject acTable, tdf.Name
DoCmd.Echo True, "Progress: Deleting table " & tdf.Name
End If
Next tdf

End Sub



QED.

G LS
 
Thanks, I'll give it a try. I tell later how it worked.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top