In an Access project (*.adp), you can use the OpenView macro action to open a view in Datasheet view, Design view, or Print Preview. This action runs the named view when opened in Datasheet view. You can select data entry for the view and restrict the records that the view displays.

Note: This action will not be allowed if the database is not trusted.

Note: Access 2010 is the last version that supports Access data projects.


The OpenView macro action has the following arguments.

Action argument


View Name

The name of the view to open. The View Name box in the Action Arguments section of the macro design window shows all views in the current database. This is a required argument.

If you run a macro containing the OpenView macro action in a library database, Access first looks for the view with this name in the library database, and then in the current database.


The view in which the view 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 view. This applies only to views opened in Datasheet view. Click Add (the user can add new records but can't view or edit existing records), Edit (the user can view or 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 a view in the Navigation Pane, or right-clicking the view in the Navigation Pane and then clicking the command you want.


  • You can drag a view from the Navigation Pane to the macro design window. This automatically creates an OpenView macro action that opens the view in Datasheet view.

  • If you don't want to display the system messages that normally appear when a view is run (indicating it is a view and showing how many records will be affected), you can use the SetWarnings macro action to suppress the display of these messages.

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

Need more help?

Expand your skills
Explore Training
Get new features first
Join Microsoft Insiders

Was this information helpful?

What affected your experience?

Thank you for your feedback!