Databases Reference
In-Depth Information
14.8.12 Documents
We have seen that applications (including Jet and Access) store objects through the use of
Container
objects. However, the
Forms
Container
object, for example, is not of any real
interest per se. The
Form
objects that reside within the
Forms
container are of interest.
Actually, these
Form
objects are referred to as
Document
objects and are contained in the
Documents
collection of the
Forms
container, also shown in Figure 14-6. (If you are
getting a bit confused, Figure 14-6 should help—it always helps me.)
Thus, it is the
Document
objects (in a
Documents
collection) that are the raison d'être for
the
Container
objects. Example 14-11 illustrates a few of the properties of a
Document
object: Container, DateCreated, LastUpdated, Name, and Owner. It displays the value of
various properties of the
Document
objects in the
Documents
collection of the
Tables
Container
object.
Example 14-11. Properties of the Document object
Sub
exaTablesDocuments( )
Dim db As DATABASE
Set db = CurrentDb
Dim docs As Documents
Dim doc As Document
Set docs = db.Containers!Tables.Documents
Debug.Print "Count: " & docs.Count
For Each doc In docs
Debug.Print "Container: " & doc.Container
Debug.Print "DateCreated: " & doc.DateCreated
Debug.Print "LastUpdated: " & doc.LastUpdated
Debug.Print "Name: " & doc.Name
Debug.Print "Owner: " & doc.Owner
Debug.Print
Next doc
End Sub
Here is a portion of the output from executing Example 14-11:
Count: 16
Container: Tables
DateCreated: 10/22/96 3:16:44 PM
LastUpdated: 10/24/96 1:36:16 PM
Name: AUTHORS
Owner: admin
Container: Tables
DateCreated: 10/22/96 3:19:47 PM
LastUpdated: 10/24/96 1:36:16 PM
Name: BOOK/AUTHOR