The Object properties provide general information about objects contained in the Database window.
Note The Object properties are available for all objects in a Microsoft Access database (.mdb) and only for forms, data access pages, macros, modules, and reports in an Access project (.adp).
You can view the Object properties, and set the Description or Attributes properties, in the following ways:
You can also specify or determine the Object properties in an Access database (.mdb) by using Visual Basic. The Object properties of an Access project (.adp) are not available using Visual Basic.
Note You can only enter or edit the Description and Attributes properties. The other Object properties are set by Microsoft Access and are read-only.
The objects for which you can display properties in the Database window are tables, queries, forms, data access pages, reports, macros, and modules. Each class of objects in the database is represented by a separate DAO Document object within the DAO Containers collection. For example, the Containers collection contains a Document object that represents all the forms in the database.
The following Object properties are available from the Database window.
Property | Description |
---|---|
Name | This is the name of the object and contains the setting from the object's Name property. |
Type | This is the object's type. Microsoft Access object types are Form, Data Access Pages, Macro, Module, Query, Report, and Table. |
Description | This is the object's description and is the same as the setting for the object's Description property. You can also set the object's Description property in the object's property sheet. An object's description also appears next to the object's name in the Database window if you click Details on the View menu. |
Created | This is the date that the object was created. For tables and queries, this property is the same as the DateCreated property. |
Modified | This is the date that the object was last modified. For tables and queries, this property is the same as the LastUpdated property. |
Owner | This is the owner of the object. For more information, see the Owner property. |
Attributes | This property specifies whether the object is hidden or visible and whether the object can be replicated in a database replica. If you set the Hidden attribute to True (by selecting the Hidden check box), the object won't appear in the Database window. To display hidden objects in the Database window, click Options on the Tools menu, click the View tab, and then select the Hidden Objects check box. The icons for hidden objects will be dimmed in the Database window. You can then turn the Hidden attribute off, making the objects visible in the Database window. |
The following example uses the PrintObjectProperties subroutine to print the values of an object's Object properties to the Debug window. The subroutine requires the object type and object name as arguments.
Dim strObjectType As String
Dim strObjectName As String
Dim strMsg As String
strMsg = "Enter object type (e.g., Forms, Scripts, " _
& "Modules, Reports, Tables)."
' Get object type.
strObjectType = InputBox(strMsg)
strMsg = "Enter the name of a form, macro, module, " _
& "query, report, or table."
' Get object name from user.
strObjectName = InputBox(strMsg)
' Pass object type and object name to
' PrintObjectProperties subroutine.
PrintObjectProperties strObjectType, strObjectName
Sub PrintObjectProperties(strObjectType As String, strObjectName _
As String)
Dim dbs As Database, ctr As Container, doc As Document
Dim intI As Integer
Dim strTabChar As String
Dim prp As DAO.Property
Set dbs = CurrentDb
strTabChar = vbTab
' Set Container object variable.
Set ctr = dbs.Containers(strObjectType)
' Set Document object variable.
Set doc = ctr.Documents(strObjectName)
doc.Properties.Refresh
' Print the object name to Debug window.
Debug.Print doc.Name
' Print each Object property to Debug window.
For Each prp in doc.Properties
Debug.Print strTabChar & prp.Name & " = " & prp.Value
Next
End Sub