Table of contents
TOC
折叠目录
展开目录

DoCmd.OpenView 方法 (的访问)DoCmd.OpenView Method (Access)

office 365 dev account|上次更新日期: 2018/4/3
|
2 参与人员

在 Visual Basic 中的OpenView操作执行OpenView方法。The OpenView method carries out theOpenView action in Visual Basic.

语法Syntax

expression.expression.OpenView(* * ViewName,* *查看,* * DataMode* )OpenView( ** ViewName, ** View, ** DataMode* )

expression:表示 DoCmd 对象的变量。expression A variable that represents a DoCmd object.

参数Parameters

名称Name必需/可选Required/Optional数据类型Data Type说明Description
ViewNameViewName必需RequiredVariantVariant字符串表达式,表示当前数据库中的视图的有效名称。A string expression that's the valid name of a view in the current database.如果包含类库数据库中的OpenView方法的 Visual Basic 代码执行时,Microsoft Access 查找同名先在类库数据库中,然后在当前数据库中的视图。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.
ViewView可选OptionalAcViewAcView一个AcView常量,指定将在其中打开该视图的视图。A AcView constant that specifies the view in which the view will open.默认值是 acViewNormalThe default value is acViewNormal.
DataModeDataMode可选Optional函数的打开模式AcOpenDataMode函数的打开模式常量,用于指定视图的数据输入模式。A AcOpenDataMode constant that specifies the data entry mode for the view.默认值是 acEditThe default value is acEdit.

注解Remarks

在 Microsoft Access 项目中,您可以使用OpenView方法可以在数据表视图、 设计视图的视图或打印预览中打开一个视图。In a Microsoft Access project, you can use the OpenView method 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.

如果您不想显示的系统消息 (表示它视图,并显示将受影响的记录数),视图运行时通常显示,可以使用SetWarnings方法来禁止显示这些消息。If you don't want to display the system messages that normally appear when a view is run (indicating it's a view and showing how many records will be affected), you can use the SetWarnings method to suppress the display of these messages.

示例Example

下面的示例打开 Employees 视图。The following example opens the Employees view.

DoCmd.OpenView "Employees"

另请参阅See also

概念Concepts

DoCmd 对象DoCmd Object

© 2018 Microsoft