SelectObject Action [Access 2003 VBA Language Reference]

You can use the SelectObject action to select a specified database object.

Setting

The SelectObject action has the following arguments.

Action argument Description
Object Type The type of database object to select. Click Table, Query, Form, Report, Macro, Module, Data Access Pages, Server View, Diagram, Stored Procedure, or Function in the Object Type box in the Action Arguments section of the Macro window. This is a required argument.
Object Name The name of the object to select. The Object Name box shows all objects in the database of the type selected by the Object Type argument. This is a required argument, unless you set the In Database Window argument to Yes. If you set the In Database Window argument to Yes and leave the Object Name argument blank, Microsoft Access selects the tab in the Database window that corresponds to the database object you specify in the Object Type argument.

Note  The object names for Server View, Diagram, or Stored Procedure objects are not displayed in the Object Name box of an Access project (.adp).

In Database Window Specifies whether Access selects the object in the Database window. Click Yes (to select the object in the Database window) or No (not to select the object in the Database window). The default is No.

Remarks

The SelectObject action works with any Access object that can receive the focus. This action gives the specified object the focus and shows the object if it's hidden. If the object is a form, the SelectObject action sets the form's Visible property to Yes and returns the form to the mode set by its form properties (for example, as a modal or pop-up form).

If the object isn't open in one of the other Access windows, you can select it in the Database window by setting the In Database Window argument to Yes. If you set the In Database Window argument to No, an error message appears when you try to select an object that isn't open.

Often, you might use this action to select an object on which you want to perform additional actions. For example, you may want to restore an object that has been minimized (by using the Restore action) or maximize a window that contains an object you want to work with (by using the Maximize action).

If you select a form, you can use the GoToControl, GoToRecord, and GoToPage actions to move to specific areas on the form. The GoToRecord action also works for datasheets.

To run the SelectObject action in Visual Basic, use the SelectObject method of the DoCmd object.