>

Inherit Property

Applies To

Container Object.

Description

Determines whether new Document objects will inherit a default Permissions property setting.

Return Values

The return values are Boolean data type.

Remarks

Use the Inherit property in conjunction with the Permissions property to define what permissions new documents will automatically be given when they're created. If you set the Inherit property to True (-1), and then set a permission on a container, then whenever a new document is created in that container, that permission will be set on the new document. This is a very convenient way of presetting permissions on an object.

Setting the Inherit property will not affect existing documents in the container — you can't modify all the permissions on all existing documents in a container by setting the Inherit property and a new permission. It will affect only new documents that are created after the Inherit property is set.

See Also

Document Object, Permissions Property.

Example

This example sets the Table container's Inherit property to True, and then sets the Permissions property to allow users to alter the security settings of documents.


Dim dbsNorthwind As Database, conTables As Container
Set dbsNorthwind =  DBEngine.Workspaces(0).OpenDatabase("Northwind.mdb")
Set conTables = dbsNorthwind.Containers("Tables")
conTables.Inherit = True
conTables.Permissions = dbSecWriteSec
dbsNorthwind.Close
Example (Microsoft Access)

The following example sets the Inherit property of the Forms Container object to True (-1), and then sets the Permissions property to give users full security access to all forms. All new Document objects of the Form type will inherit these permissions. The procedure then creates a new Form object and displays the permissions for that object.

Note that the Forms Container object is different from the Forms collection. The Forms Container object includes all Form Document objects in the database; the Forms collection contains only currently open forms.


Sub FormPermissions()
    Dim dbs As Database, ctrForms As Container
    Dim docForm As Document, frmNew As Form

    ' Return Database variable that points to current database.
    Set dbs = CurrentDb
    ' Return Container variable pointing to Forms Container object.
    Set ctrForms = dbs.Containers!Forms
    ' Set Inherit property.
    ctrForms.Inherit = True
    ' Set permissions to be inherited.
    ctrForms.Permissions = ctrForms.Permissions Or acSecFrmRptWriteDef
    ' Create new form.
    Set frmNew = CreateForm()


    ' Save form.
    DoCmd.Save , "OrderForm"
    ' Return Document object associated with new form.
    Set docForm = ctrForms.Documents!OrderForm
    ' Compare permissions for Container and Document objects.
    If docForm.Permissions <> ctrForms.Permissions Then
        MsgBox "Error!"
    Else
        MsgBox "Permissions successfully inherited."
    End If
End Sub