Databases Reference
In-Depth Information
' List all properties
str = ""
For Each prp In tbl.Properties
str = str & prp.Name
str = str & " = " & prp.Value
str = str & " (" & prp.Type & ") "
str = str & prp.Inherited & vbCrLf
Next prp
MsgBox "BOOKS has " & tbl.Properties.Count & " properties: " & vbCrLf &
str
End Sub
This procedure produces the window shown in Figure 14-11. Note the last property on
the list.
Figure 14-11. Window generated from executing exaUserDefinedProperty
14.7 Closing DAO Objects
We should make a few remarks about closing DAO objects that have been opened
programmatically. The
Database
,
Recordset
, and
Workspace
objects each have a
Close
method. This method will remove these objects from their respective collections. This is
appropriate for the three object types mentioned previously for the following reasons:
The
Databases
collection is defined to be the collection of all open database
objects.
•
The
Recordset
objects are temporary objects, to be used only for data-
manipulation purposes.
•
Attempts to close the default
Workspace
object are ignored, but you can close
other
Workspace
objects.
•
Note that objects of types other than the three mentioned are intended to be persistent
members of their collections, stored on disk in the Access
mdb
file. However, they can be
removed from their respective collections by using the
Delete
method.