AllPermissions Property Example (MDB)

The following example checks the AllPermissions property for the Forms Container object and determines whether the user specified by the UserName property has full access to forms.

Note that the And operator performs a bitwise comparison to determine what permissions are currently set.

Sub CheckAllPermissions()
    Dim dbs As Database, ctr As Container

    ' Return reference to current database.
    Set dbs = CurrentDb
    ' Return reference to Forms container.
    Set ctr = dbs.Containers!Forms
    ' Check if AllPermissions property includes full access.
    If (ctr.AllPermissions And dbSecFullAccess = _
            dbSecFullAccess) Then
        MsgBox "User " & ctr.UserName _
            & " has full access to all forms."
    End If
    Set dbs = Nothing
End Sub