ACC: Permissions and AllPermissions Properties

ID: Q142093

The information in this article applies to:

SUMMARY

Advanced: Requires expert coding, interoperability, and multiuser skills.

The Permissions property returns only the explicit permissions that are granted to the current user. These permissions do not include the implicit permissions that the user inherits because the user is also a member of group accounts.

The AllPermissions property returns all the permissions that apply to the current user, including permissions that are specific to the user as well as the permissions a user inherits from membership in groups.

This article assumes that you are familiar with Visual Basic for Applications and with creating Microsoft Access applications using the programming tools provided with Microsoft Access. For more information about Visual Basic for Applications, please refer to your version of the "Building Applications with Microsoft Access" manual.

MORE INFORMATION

There are two levels of accounts in Microsoft Access 7.0 and 97: individual user accounts and group level accounts. Explicit permissions are permissions that are granted directly to the individual user account. The user account is identified by a user name and a personal identifier (PID). Implicit permissions are permissions that are granted to a group account. A group account is a collection of user accounts in a workgroup. A group account is identified by a group name and personal identifier. Permissions assigned to a group apply to all users in the group.

You can check the permissions an individual user has by following these steps:

1. Open the sample database Northwind.mdb.

2. On the Tools menu, click Security, and then click User And Group

   Permissions.

3. In the User And Group Permissions dialog box, under Permissions, set
   the permissions for the Admin user to Open/Run. Under Object Name,
   select Orders Subform, and under Object Type, select Form.

4. Enter the following sample code into a new module.

      Function ShowPermissions()
         Dim dbsNorthwind As DATABASE, docTest As Document
         Set dbsNorthwind = CurrentDb()
         Set docTest = dbsNorthwind.Containers(1).Documents("Orders _
            SubForm")
         Debug.Print docTest.Permissions
      End Function

5. Press CTRL+G to open the Debug Window, type "?ShowPermissions"
   (without the quotation marks), and then press ENTER. Note the value
   returned in the Debug window.

6. Replace the reference, doctest.Permissions, in the code in step 4 with
   the following reference: doctest.AllPermissions.

7. Type "?ShowPermissions" (without the quotation marks) in the Debug
   window again, and press ENTER. Note that a different value is returned.

The AllPermissions property returns the set of the permissions the user inherits from each of the groups the user belongs to, in addition to the explicit permissions granted directly to the individual user account. A user's security level is always the least restrictive of that user's explicit permissions and the permissions of any and all groups to which that user belongs.

The quickest and easiest way to administer a workgroup is to create new groups and assign permissions to the groups rather than to individual users. Then you can easily change permissions for a user by simply moving the user to a new group. You can also change permissions to an entire group in a single operation, which is much easier than for each individual user.

REFERENCES

For more information about the permissions and allpermissions properties, search the Help Index for "Permissions" or "AllPermissions," or ask the Microsoft Access 97 Office Assistant..

Keywords          : kbusage
Version           : 7.0 97
Platform          : WINDOWS
Hardware          : x86
Issue type        : kbhowto

Last Reviewed: November 20, 1998