Code to delete all tables in an mdb

J

Jim Pockmire

I can loop through all of the tables in tabledefs, but how can I test for
system tables?
 
B

BillCo

dim tbl as dao.tabledef

for each tbl in currentdb.tabledefs
if tbl.name like "MSys*" then debug.print tbl.name
next
 
D

Douglas J. Steele

The following code will identify the non-system tables:

Sub ListTables()
Dim dbCurr As DAO.Database
Dim tdfCurr As DAO.TableDef

Set dbCurr = CurrentDb()
For Each tdfCurr In dbCurr.TableDefs
If (tdfCurr.Attributes And dbSystemObject) = 0 Then
Debug.Print tdfCurr.name
End If
Next tdfCurr
Set dbCurr = Nothing

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top