适用于:Access 2013、Office 2013
Documents 集合包含特定类型对象的所有 Document 对象(仅适用于 Microsoft Access 数据库引擎数据库)。
备注
每个 Container 对象具有一个 Documents 集合,该集合包含对 Container 所指定的内置对象类型的实例进行描述的 Document 对象。
若要按照序号或 Name 属性设置来引用集合中的 Document 对象,可以使用下列任何一种语法形式:
Documents(0)
文档 (“name”)
文档![name]
示例
以下示例枚举 Tables 容器的 Documents 集合,然后枚举该集合中第一个 Document 对象的 Properties 集合。
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