Object Properties

Applies To

Form, Query, Report, Table.

Description

The Object properties provide general information about objects contained in the database window.

Setting

You can view the Object properties, and set the Description or Attributes properties, by clicking the Properties icon on the Database toolbar, clicking the Properties command on the View menu, or choosing the Properties command from the popup menu that appears when you right click on an object in the database window.

You can also specify or determine the Object properties using Visual Basic.

Note You can only enter or edit the Description or Attributes properties. The other Object properties are set by Microsoft Access and are read-only.

Remarks

The objects in the database window are: Tables, Queries, Forms, Reports, Macros, and Modules. Each class of objects in the database is represented by a separate Document object within the Containers collection. For example, the Containers collection contains a Document object that represents all the forms in the database.

The Object properties available from the database window are:

Name

This is the name of the object and contains the setting from the object’s Name property.

Type

This is the object type. Microsoft Access object types are: Form, Macro, Module, Query, Report, and Table.

Description

This is the object’s description and is the same as the Description property. For tables or queries, 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 the Details command is selected from the View menu.

Created

This is the date that the object was created. For tables or queries, this property is the same as the DateCreated property.

Modified

This is the date that the object was last modified. For tables or 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 is replicable in a database replica.

If you set the hidden attribute to True, the object will not appear in the database window. To display hidden objects in the database window choose the Options command on the Tools menu, click the View tab, and then select the Hidden objects check box. The icons for hidden objects will be displayed with a dimmed outline in the database window. You can then turn the hidden attribute off, making the object visible in the database window.

See Also

Containers Collection; DateCreated, LastUpdate Properties; Description Property; Documents Collection; Name Property; Microsoft Office 95 Data Access Reference: Description Property; Name Property.

Example

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 StringstrObjectName As StringstrMsg As String
= "Enter object type (e.g., Forms, Macros, " & _
    "Modules, Queries, Reports, Tables)"
' Get object type.= InputBox(strMsg)= "Enter the name of a Form, Macro, Module, " & _
    "Query, Report, or Table"
' Get object name from user.= InputBox(strMsg)
' Pass object type and object name to the PrintObjectProperties 
' subroutine.strObjectType, strObjectName
PrintObjectProperties(strObjectType As String, _
        strObjectName As String)
    Dim dbs As Database, cnt As Container, doc As Document
    Dim intI As Integer
    Dim strTabChar As String
    Set dbs = CurrentDb
    strTabChar = Chr$(9)
    ' Set container object variable.
    Set cnt = dbs.Containers(strObjectType)
    ' Set document object variable.
    Set doc = cnt.Documents(strObjectName)
    doc.Properties.Refresh
    ' Print the object name to the Debug window.
    Debug.Print doc.Name
    ' Print each object property to Debug window.
    For intI = 0 to doc.Properties.Count - 1
        Debug.Print strTabChar & doc.Properties(intI).Name & " = " _
            & doc.Properties(intI).Value
    Next intISub