DAO Object
 
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).
 

Remarks

Each Container object has a Documents collection containing Document objects that describe instances of built-in objects of the type specified by the Container. The following table lists the type of object each Document describes, the name of its Container object, and what type of information Document contains.
Document
Container
Contains information about
Database
Databases
Saved database
Table or query
Tables
Saved table or query
Relationship
Relations
Saved relationship
 
 Note
Don't confuse the Container objects listed in the preceding table with the collections of the same name. The Databases Container object refers to all saved database objects, but the Databases collection refers only to database objects that are open in a particular workspace.
 
With a Document object, you can:
 
Because a Document object corresponds to an existing object, you can't create new Document objects or delete existing ones. To refer to a Document object in a collection by its ordinal number or by its Name property setting, use any of the following syntax forms:
 

Methods

Name
Description
Creates a new user-defined Property object (Microsoft Access workspaces only).
 

Properties

Name
Description

Returns the name of the Container object to which a Document object belongs (Microsoft Access workspaces only). .
Returns the date and time that an object was created. Read-only Variant.
Returns the date and time of the most recent change made to an object. Read-only Variant.
Returns the name of the specified object. Read-only String.

Returns the Properties collection of the specified object. Read-only.

 

Example

This example enumerates the Documents collection of the Tables container, and then enumerates the Properties collection of the first Document object in the collection.
 
Sub DocumentX()
 
Dim dbsNorthwind As Database
Dim docLoop As Document
Dim prpLoop As Property
 
Set dbsNorthwind = OpenDatabase("Northwind.mdb")
 
With dbsNorthwind.Containers!Tables
Debug.Print "Documents in " & .Name & " container"
' Enumerate the Documents collection of the Tables
' container.
For Each docLoop In .Documents
Debug.Print " " & docLoop.Name
Next docLoop
With .Documents(0)
' Enumerate the Properties collection of the first.
' Document object of the Tables container.
Debug.Print "Properties of " & .Name & " document"
On Error Resume Next
For Each prpLoop In .Properties
Debug.Print " " & prpLoop.Name & " = " & _
prpLoop
Next prpLoop
On Error GoTo 0
End With
End With
 
dbsNorthwind.Close
 
End Sub
 
This example uses the Owner and SystemDB properties to show the owners of a variety of Document objects.
 
Sub OwnerX()
 
' Ensure that the Microsoft Access workgroup file is
' available.
DBEngine.SystemDB = "system.mdw"
 
Dim dbsNorthwind As Database
Dim ctrLoop As Container
 
Set dbsNorthwind = OpenDatabase("Northwind.mdb")
 
With dbsNorthwind
Debug.Print "Document owners:"
' Enumerate Containers collection and show the owner
' of the first Document in each container's Documents
' collection.
For Each ctrLoop In .Containers
With ctrLoop
Debug.Print " [" & .Documents(0).Name & _
"] in [" & .Name & _
"] container owned by [" & _
.Documents(0).Owner & "]"
End With
Next ctrLoop
 
.Close
End With
 
End Sub