Attributes Property Example (MDB)

The following example checks the Attributes property for each table in the current database, and prints the names of system and hidden tables provided by the Microsoft Jet database engine.

Note that the And operator performs a bitwise comparison to determine whether an attribute is currently set.

Sub CheckAttributes()
    Dim dbs As Database, tdf As TableDef

    ' Return reference to current database.
    Set dbs = CurrentDb
    For Each tdf In dbs.TableDefs
        ' Compare property setting and constant in question.
        If (tdf.Attributes And dbSystemObject) Or _
                (tdf.Attributes And dbHiddenObject) Then
            Debug.Print tdf.Name
        End If
    Next tdf
    Set dbs = Nothing
End Sub