OpenTable Action

Description

You can use the OpenTable action to open a table in Datasheet view, Design view, or Print Preview. You can also select a data entry mode for the table.

Setting

The OpenTable action has the following arguments.

Action argument

Description

Table Name

The name of the table to open. The Table Name box in the Action Arguments section of the Macro window shows all tables in the current database. This is a required argument.

If you run a macro containing the OpenTable action in a library database, Microsoft Access looks for the table with this name first in the library database, then in the current database.

View

The view in which the table will open. Click Datasheet, Design, or Print Preview in the View box. The default is Datasheet.

Data Mode

The data entry mode for the table. This applies only to tables opened in Datasheet view. Click Add (the user can add new records but can't edit existing records), Edit (the user can edit existing records and add new records), or Read Only (the user can only view records). The default is Edit.


Remarks

This action is similar to clicking the Open button or Design button in the Database window after selecting a table on the Tables tab.

Tip You can select a table in the Database window and drag it to a macro action row. This automatically creates an OpenTable action that opens the table in Datasheet view.

Switching to Design view while the table is open removes the table's Data Mode argument setting. This setting won't be in effect even if the user returns to Datasheet view.

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

See Also

OpenTable method.