OpenTable Macro Action

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


The OpenTable action has the following arguments.

Action argument


Table Name

The name of the table to open. The Table Name box in the Action Arguments section of the Macro Builder pane 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, Access looks for the table with this name first in the library database, then in the current database.


The view in which the table will open. Click Datasheet, Design, Print Preview, PivotTable, or PivotChart 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.


This action is similar to double-clicking the table in the Navigation Pane, or right-clicking the table in the Navigation Pane and selecting a view.


You can drag a table from the Navigation Pane to a macro action row. This automatically creates an OpenTable action that opens the table in Datasheet view.

To run the OpenTable action in a Visual Basic for Applications (VBA) module, use the OpenTable method of the DoCmd object.

Need more help?

Expand your Office skills
Explore training
Get new features first
Join Office Insiders

Was this information helpful?