編輯

共用方式為


SetPermissions method (ADOX)

Applies to: Access 2013, Office 2013

Specifies the permissions for a group or user on an object.

Syntax

GroupOrUser.SetPermissionsName, ObjectType, Action, Rights [,Inherit] [,ObjectTypeId]

Parameters

Parameter Description
Name A String value that specifies the name of the object for which to set permissions.
ObjectType A Long value which can be one of the ObjectTypeEnum constants, that specifies the type of the object for which to get permissions.
Action A Long value which can be one of the ActionEnum constants that specifies the type of action to perform when setting permissions.
Rights A Long value which can be a bitmask of one or more of the RightsEnum constants, that indicates the rights to set.
Inherit Optional. A Long value which can be one of the InheritTypeEnum constants, that specifies how objects will inherit these permissions. The default value is adInheritNone.
ObjectTypeId Optional. A Variant value that specifies the GUID for a provider object type not defined by the OLE DB specification. This parameter is required if ObjectType is set to adPermObjProviderSpecific; otherwise, it is not used.

Remarks

An error will occur if the provider does not support setting access rights for groups or users.

Note

When calling SetPermissions, setting Actions to adAccessRevoke overrides any settings of the Rights parameter. Do not set Actions to adAccessRevoke if you want the rights specified in the Rights parameter to take effect.