SelectObject Method

Description

The SelectObject method carries out the SelectObject action in Visual Basic. For more information on how the action and its arguments work, see the action topic.

Syntax

DoCmd.SelectObject objecttype, objectname [, indatabasewindow]

The SelectObject method uses the following arguments.

Argument

Description

objecttype

One of the following intrinsic constants:

acTable
acQuery
acForm
acReport
acMacro
acModule


Argument

Description

objectname

A string expression that is the valid name of an object of the type selected with the objecttype argument.

indatabasewindow

Use True (-1) to select the object in the Database window. Use False (0) to select an object that is already open. If you leave this argument blank, the default (False) is assumed.


Remarks

If you leave the indatabasewindow argument blank, don’t use a comma following the objectname argument.

Example

This example selects the form Customers in the Database window.


DoCmd.SelectObject acForm, "Customers", True