OpenView Action

In a Microsoft Access project, you can use the OpenView action to open a view in Datasheet view, 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.

Setting

The OpenView action has the following arguments.

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

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

View 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.

Remarks

This action is similar to clicking the Open button or Design button after clicking Queries    under Objects, and then selecting a view in the Database window.

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

Tips

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