You can use the SelectObject action to select a specified database object.
The SelectObject action uses the following arguments.
Action argument |
Description |
Object Type |
The type of database object to select. Click Table, Query, Form, Report, Macro, or Module from 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 box. This is a required argument. |
In Database Window |
Determines whether Microsoft Access selects the object in the Database window. Click Yes to select the object or No not to select the object in the Database window. The default is No. |
The SelectObject action works with any Microsoft Access object that can receive the focus. This action gives the specified object the focus and shows the object if it is 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 Microsoft 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 (using the Restore action) or maximize a window that contains an object you want to work with (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.
Restore Action, SelectObject Method, SetValue Action.