SelectObject Method
This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.
The SelectObject method carries out the SelectObject action in Visual Basic.
expression.SelectObject(ObjectType, ObjectName, InDatabaseWindow)
expression Required. An expression that returns one of the objects in the Applies To list.
AcObjectType
AcObjectType can be one of these AcObjectType constants. |
acDataAccessPage |
acDefault |
acDiagram |
acForm |
acFunction |
acMacro |
acModule |
acQuery |
acReport |
acServerView |
acStoredProcedure |
acTable
Note The constant acDefault, which appears in the Auto List Members list for this argument, is invalid for this argument. You must choose one of the constants listed above. |
ObjectName Optional Variant. A string expression that's the valid name of an object of the type selected by the objecttype argument. This is a required argument, unless you specify True (–1) for the indatabasewindow argument. If you specify True for the indatabasewindow argument and leave the objectname argument blank, Microsoft Access selects the tab in the Database window that corresponds to the database object you specify in the objecttype argument.
InDatabaseWindow Optional Variant. Use True to select the object in the Database window. Use False (0) to select an object that's already open. If you leave this argument blank, the default (False) is assumed.
Remarks
For more information on how the action and its arguments work, see the action topic.
If you set the indatabasewindow argument to True and leave the objectname argument blank, you must include the objectname argument's comma. If you leave a trailing argument blank, don't use a comma following the last argument you specify.
Example
The following example selects the form Customers in the Database window:
DoCmd.SelectObject acForm, "Customers", True