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

DoCmd.AddMenu 方法 (访问)DoCmd.AddMenu Method (Access)

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

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

语法Syntax

表达式AddMenu(* * MenuName,* * MenuMacroName,* 状态栏)expression. **AddMenu( ** MenuName, ** MenuMacroName, ** StatusBarText* )

表达式_一个表示DoCmd对象的变量。_expression A variable that represents a DoCmd object.

参数Parameters

名称Name必需/可选Required/Optional数据类型Data Type说明Description
MenuNameMenuName必需RequiredVariantVariant字符串表达式,表示要添加到自定义菜单栏或全局菜单栏的下拉列表菜单的有效名称。若要创建访问键以便您可以使用键盘来选择菜单,键入 and 符 (&;) 想要用作访问键的字母前。在菜单栏上的菜单名中,该字母将带有下划线。A string expression that's the valid name of a drop-down menu to add to the custom menu bar or global menu bar. To create an access key so that you can use the keyboard to choose the menu, type an ampersand (&;) before the letter you want to be the access key. This letter will be underlined in the menu name on the menu bar.
MenuMacroNameMenuMacroName必需RequiredVariantVariant字符串表达式,代表宏组的有效名称,该宏组包含菜单命令的宏。该参数是必需参数。A string expression that's the valid name of the macro group that contains the macros for the menu's commands. This is a required argument.
状态栏文字StatusBarText必需RequiredVariantVariant字符串表达式,代表选中菜单时显示在状态栏中的文本。A string expression that's the text to display in the status bar when the menu is selected.

注解Remarks

使用 AddMenu 操作可以创建下列内容:You can use the AddMenu action to create:

  • 窗体或报表的自定义菜单栏。自定义菜单栏可替换窗体或报表的内置菜单栏。A custom menu bar for a form or report. The custom menu bar replaces the built-in menu bar for the form or report.

  • 窗体、窗体控件或报表的自定义快捷菜单。自定义快捷菜单可替换窗体、窗体控件或报表的内置快捷菜单。A custom shortcut menu for a form, form control, or report. The custom shortcut menu replaces the built-in shortcut menu for the form, form control, or report.

  • 全局菜单栏。全局菜单栏可替换所有 Microsoft Access 窗口的内置菜单栏,但您在其中为窗体或报表添加了自定义菜单栏的内置菜单栏除外。A global menu bar. The global menu bar replaces the built-in menu bar for all Microsoft Access windows, except where you've added a custom menu bar for a form or report.

  • 全局快捷菜单。对于表和查询数据表中的字段,窗体视图、数据表视图和打印预览中的窗体,以及打印预览中的报表,全局快捷菜单可替换它们的内置快捷菜单,但您在其中为窗体、窗体控件或报表添加了自定义快捷菜单的内置快捷菜单除外。A global shortcut menu. The global shortcut menu replaces the built-in shortcut menu for fields in table and query datasheets, forms in Form view, Datasheet view, and Print Preview, and reports in Print Preview, except where you've added a custom shortcut menu for a form, form control, or report.

自定义菜单栏和全局菜单栏的AddMenu方法中必须包括_menuname_和_menumacroname_参数。Menuname_参数不是必需参数,对于自定义快捷菜单和全局快捷菜单将被忽略。You must include the _menuname and menumacroname arguments in the AddMenu method for custom menu bars and global menu bars. The menuname argument is not required and will be ignored for custom shortcut menus and global shortcut menus.

状态栏文字_参数是可选的对于自定义快捷菜单和全局快捷菜单,则忽略此参数。The _statusbartext argument is optional, this argument is ignored for custom shortcut menus and global shortcut menus.

另请参阅See also

概念Concepts

DoCmd 对象DoCmd Object

© 2018 Microsoft