AllPermissions Property

Applies To

Container object, Docume5nt object.

Description

Returns all the permissions that apply to the current UserName property of the Container or Document object, including permissions that are specific to the user as well as the permissions a user inherits from memberships in groups (Microsoft Jet workspaces only).

Return Values

For any Container or Document object, the return value is a Long value or constant(s) that may include the following.

Constant

Description

dbSecReadDef

The user can read the table definition, including column and index information.

dbSecWriteDef

The user can modify or delete the table definition, including column and index information.

dbSecRetrieveData

The user can retrieve data from the Document object.

dbSecInsertData

The user can add records.

dbSecReplaceData

The user can modify records.

dbSecDeleteData

The user can delete records.


In addition, the Databases container or any Document object in a Documents collection may include the following.

Constant

Description

dbSecDeleteData

The user can delete records.

dbSecDBAdmin

The user can replicate the database and change the database password.

dbSecDBCreate

The user can create new databases. This setting is valid only on the Databases container in the workgroup information file (System.mdw).

dbSecDBExclusive

The user has exclusive access to the database.

dbSecDBOpen

The user can open the database.


Remarks

This property contrasts with the Permissions property, which returns only the permissions that are specific to the user and doesn't include any permissions that the user may also have as a member of groups. If the current value of the UserName property is a group, then the AllPermissions property returns the same values as the Permissions property.

Specifics (Microsoft Access)

Microsoft Access defines four types of Container objects in addition to those defined by the Microsoft Jet database engine. These include the Forms, Reports, Scripts, or Modules Container objects. Individual Form, Report, Script and Module Document objects belong to the Documents collections of these Container objects. For these Container and Document objects, you can also set the AllPermissions property to the following constants.

Constant

User or group can

acSecFrmRptReadDef

Open the form or report in Design view but not make any changes.

acSecFrmRptWriteDef

Modify or delete the form or report in Design view.

acSecFrmRptExecute

Open the form in Form view or Datasheet view; print or open the report in Sample Preview or Print Preview.

acSecMacReadDef

Open the Macro window and view a macro without making changes.

acSecMacWriteDef

Modify or delete the macro in the Macro window.

acSecModReadDef

Open the module but not make any changes.

acSecModWriteDef

Modify or delete the contents of a module.

acSecMacExecute

Run the macro.


Example

This example uses the SystemDB, AllPermissions, and Permissions properties to show how users can have different levels of permissions depending on the permissions of the group to which they belong.

Sub AllPermissionsX()

    ' Ensure that the Microsoft Jet workgroup information
    ' file is available.
    DBEngine.SystemDB = "system.mdw"

    Dim dbsNorthwind As Database
    Dim ctrLoop As Container

    Set dbsNorthwind = OpenDatabase("Northwind.mdb")

    ' Enumerate Containers collection and display the current
    ' user and the permissions set for that user.
    For Each ctrLoop In dbsNorthwind.Containers
        With ctrLoop
            Debug.Print "Container: " & .Name
            Debug.Print "User: " & .UserName
            Debug.Print "    Permissions: " & .Permissions
            Debug.Print "    AllPermissions: " & _
                .AllPermissions
        End With
    Next ctrLoop

    dbsNorthwind.Close

End Sub
Example (Microsoft Access)

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 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