Class Document (DAO VBA)
A Document object includes information about one instance of an object. The object can be a database, saved table, query, or relationship (Microsoft Access database engine databases only). To use a Document class variable it first needs to be instantiated, for example
Dim doc as Document
Set doc = Workspaces(1).Databases(1).Containers(1).Documents(Item:=1)
AllPermissions
Dim doc As DAO.Document: Set doc =
doc.AllPermissions
Container
Returns the name of the Container object to which a Document object belongs (Microsoft Access workspaces only).
Sub ContainerPropertyX()
Dim dbsNorthwind As Database
Dim ctrLoop As Container
Set dbsNorthwind = OpenDatabase("Northwind.mdb")
' Display the container name for the first Document
' object in each Container object's Documents collection.
For Each ctrLoop In dbsNorthwind.Containers
Debug.Print "Document: " & ctrLoop.Documents(0).Name
Debug.Print " Container = " & _
ctrLoop.Documents(0).Container
Next ctrLoop
dbsNorthwind.Close
End Sub
CreateProperty
Creates a new user-defined Property object (Microsoft Access workspaces only).
You can create a user-defined Property object only in the Properties collection of an object that is persistent. If you omit one or more of the optional parts when you use CreateProperty, you can use an appropriate assignment statement to set or reset the corresponding property before you append the new object to a collection. After you append the object, you can alter some but not all of its property settings. See the Name, Type, and Value property topics for more details. If name refers to an object that is already a member of the collection, a run-time error occurs when you use the Append method. To remove a user-defined Property object from the collection, use the Delete method on the Properties collection. You can't delete built-in properties.
CreateProperty (Name, Type, Value, DDL)
Dim doc As DAO.Document: Set doc =
Dim prpCreateProperty As DAO.Property
Set prpCreateProperty = doc.CreateProperty
Arguments
Optional arguments
The following arguments are optional
Name (String) - A String that uniquely names the new Property object. See the Name property for details on valid Property names.
Type - A constant that defines the data type of the new Property object. See the Type property for valid data types
Value (Variant) - A Variant containing the initial property value. See the Value property for details.
DDL (Boolean) - A Variant (Boolean subtype) that indicates whether or not the Property is a DDL object. The default is False. If DDL is True, users can't change or delete this Property object unless they have dbSecWriteDef permission.
DateCreated
Returns the date and time that an date was created. Read-only Variant.
Dim doc As DAO.Document: Set doc =
doc.DateCreated
LastUpdated
Returns the date and time of the most recent change made to an date. Read-only Variant.
DateCreated and LastUpdated return the date and time that the object was created or last updated. In a multiuser environment, users should get these settings directly from the file server to avoid discrepancies in the DateCreated and LastUpdated property settings.
Dim doc As DAO.Document: Set doc =
doc.LastUpdated
Name
Returns the name of the specified object.
Dim doc As DAO.Document: Set doc =
doc.Name
Owner
Dim doc As DAO.Document: Set doc =
doc.Owner =
Permissions
Dim doc As DAO.Document: Set doc =
doc.Permissions =
Properties
Returns the Properties collection of the specified object.
Dim doc As DAO.Document: Set doc =
doc.Properties
UserName
Dim doc As DAO.Document: Set doc =
doc.UserName =