I can loop through all of the tables in tabledefs, but how can I test for
system tables?
BillCo - 01 Dec 2006 16:30 GMT
dim tbl as dao.tabledef
for each tbl in currentdb.tabledefs
if tbl.name like "MSys*" then debug.print tbl.name
next
> I can loop through all of the tables in tabledefs, but how can I test for
> system tables?
Allen Browne - 01 Dec 2006 16:30 GMT
Try:
If (tdf.Attributes And dbSystemObject) = 0 Then

Signature
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
>I can loop through all of the tables in tabledefs, but how can I test for
>system tables?
Douglas J. Steele - 01 Dec 2006 16:30 GMT
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

Signature
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)
>I can loop through all of the tables in tabledefs, but how can I test for
>system tables?