OpenView Method

Microsoft Access Visual Basic

OpenView Method

       

The OpenView method carries out the OpenView action in Visual Basic.

expression.OpenView(ViewName, View, DataMode)

expression   Required. An expression that returns one of the objects in the Applies To list.

ViewName  Required Variant.  A string expression that's the valid name of a view in the current database. If you execute Visual Basic code containing the OpenView method in a library database, Microsoft Access looks for the view with this name first in the library database, then in the current database.

View  Optional AcView.

AcView can be one of these AcView constants.
acViewDesign
acViewNormal default
acViewPivotChart
acViewPivotTable
acViewPreview

If you leave this argument blank, the default constant (acViewNormal) is assumed.

DataMode  Optional AcOpenDataMode.

AcOpenDataMode can be one of these AcOpenDataMode constants.
acAdd
acEdit default
acReadOnly

If you leave this argument blank, the default constant (acEdit) is assumed.

Remarks

For more information on how the action and its arguments work, see the action topic.

Example

The following example opens the Employees view.

DoCmd.OpenView "Employees"