>
Container Property
Applies To
Document Object.
Description
Returns the name of the Container object to which a Document object belongs.
Return Values
This property's return value is a String data type.
See Also
Container Object.
Example
This example determines the name of the Container object to which a Document object belongs.
Sub Doc_Analyzer(docUnknown As Document)
Dim strContainerName As String
strContainerName = docUnknown.Container
Select Case strContainerName
Case "Tables"
...
Case "Databases"
...
Case "Forms"
...
Case Else
...
End Select
End Sub
Example (Microsoft Access)
The following example determines the name of the Container object to which a Document object belongs, and sets permissions accordingly for the specified group account. Remember that you must denote a particular user or group account before you set permissions for an object. The following example assumes that you have defined a Marketers group.
Note that Microsoft Access defines additional Container objects beyond those defined by the Microsoft Jet database engine. These include the Form, Report, Script, and Module Container objects.
Sub DocAnalyzer(docUnknown As Document)
Dim strContainerName As String
' Set UserName property to valid existing group account.
docUnknown.UserName = "Marketers"
' Get value of Container property.
strContainerName = docUnknown.Container
Select Case strContainerName
Case "Forms"
' Set permissions for Form Document object.
docUnknown.Permissions = docUnknown.Permissions Or _
acSecFrmRptWriteDef
Case "Reports"
' Set permissions for Report Document.
docUnknown.Permissions = docUnknown.Permissions Or _
acSecFrmRptExecute
Case "Scripts"
' Set permissions for Script Document.
docUnknown.Permissions = docUnknown.Permissions Or _
acSecMacWriteDef
Case "Modules"
' Set permissions for Module Document object.
docUnknown.Permissions = docUnknown.Permissions Or _
acSecModReadDef
Case Else
Exit Sub
End Select
End Sub