>
Owner Property
Applies To
Container Object, Document Object.
Description
Sets or returns a value that specifies the owner of the object.
Settings and Return Values
The setting or return value is a string expression that evaluates to either the name of a User object in the Users collection or the name of a Group object in the Groups collection. The data type is String.
Remarks
The owner of an object has certain access privileges denied to other users. The Owner property setting can be changed at any time by any individual user account (represented by a User object) or group of user accounts (represented by a Group object) having the appropriate permissions.
See Also
Permissions Property, User Object.
Example
This example changes the Owner property setting of a Document object after determining whether the current user has the appropriate permissions to do so.
Dim dbsNorthwind As Database, docTest As Document
Set dbsNorthwind = DBEngine.Workspaces(0).OpenDatabase("Northwind.mdb")
Set docTest = dbsNorthwind.Containers(0).Documents(0)
If (docTest.Permissions And dbSecWriteOwner) <> 0 Then
docTest.Owner = "SomebodyElse"
End If
Example (Microsoft Access)
The following example changes the Owner property setting of a Module Document object after determining whether the current user has the appropriate permissions to do so.
Note that the And operator performs a bitwise comparison to determine whether a certain permission is currently set.
Sub ChangeOwner()
Dim dbs As Database, ctrModules As Container, docModule As Document
' Return Database variable that points to current database.
Set dbs = CurrentDb
' Return Container variable that points to Modules container.
Set ctrModules = dbs.Containers!Modules
' Return Document object that points to ValuableFunctions module.
Set docModule = ctrModules.Documents!ValuableFunctions
' Compare current permissions with owner permissions.
If (docModule.Permissions And dbSecWriteOwner) <> 0 Then
docModule.Owner = "SomebodyElse"
End If
End Sub