The following example creates a shortcut menu named cmdReportRightClick that contains commands that are useful to use with a report. Controls.Add msoControlButton, 10062,, , True Controls.Add msoControlButton, 3017,, , True ' Add the Filter Excluding Selection command. Controls.Add msoControlButton, 640,, , True Controls.Add(msoControlButton, 605,, , True).BeginGroup = True ' Start a new grouping and add the Remove Filer/Sort command. Controls.Add msoControlButton, 211,, , True Controls.Add(msoControlButton, 210,, , True).BeginGroup = True ' Start a new grouping and add the Sort Ascending command. Controls.Add msoControlButton, 141,, , True Set cmbRightClick = CommandBars.Add("cmdFormFiltering", msoBarPopup, False, True) In this example, the BeginGroup property is used on several controls to group controls visually. The following example creates a shortcut menu named cmdFormFiltering that contains commands that are useful to use with Continuous forms. For this example, set the Shortcut Menu Bar property to SimpleShortcutMenu. To assign the shortcut menu to a form, form control, or report, set the Shortcut Menu property of the object to Yes and set the Shortcut Menu Bar property of the object to the name of the shortcut menu. You don't have to run the same code to re-create the shortcut menu every time that you open the database. Set cmbShortcutMenu = CommandBars.Add("SimpleShortcutMenu", msoBarPopup, False, True)Ĭ Type:=msoControlButton, Id:=605Ĭ Type:=msoControlButton, Id:=640Īfter you've run the code, the shortcut menu is saved as part of the database. ' Create a shortcut menu named "SimpleShortcutMenu. See Set References to Type Libraries for more information about how to set references. To use the following examples, you must set a reference to the Microsoft Office 15.0 Object Library. The following example creates a shortcut menu named SimpleShortcutMenu that contains two commands, Remove Filter/Sort and Filter by Selection. Each time that you create a CommandBarControl object, a command is added to the shortcut menu. Then, you use the Add method to create CommandBarControl objects. The CommandBar object represents the shortcut menu. To create a shortcut menu, you first have to create a CommandBar object. This article describes you how to create a shortcut menu using VBA. In Access 2013, you must use Visual Basic for Applications (VBA) code to create a shortcut menu. In earlier versions of Access, you could use the Customize dialog box to create custom shortcut menus. The shortcut menu appears when the user right-clicks the object to which the shortcut menu is applied. One way to do this is to create a custom shortcut menu and apply it to a form report, or control. Return to top Access 2 Menu System DoCmd.When you are designing a form or report, you may want to provide a method for a user to easily use a command that applies only to the current context. If you know of any additional conversions or spot any errors then please let me know so that I can make this area as complete as possible. Note: Some of these are items do not equate exactly and may have more than one RunCommand equivalents. Version number at the end of the line then it is using Access 1 menus. If your DoMenuItem has just numbers and no There may be some duplication as you can refer to menus both byĪ number and a constant. There are also tables for the Access 2 and Access 1 menu systems. The first table is for the Access 7 menu system. Versions there may be a fourth element stating which version of menusīelow are 3 tables showing the DoMenuItem code with what I think is the RunCommand equivalent. To the top level menu item counting from the left starting at 0. This case) refers to the menu being used. Have a piece of code that says DoMenuItem 0,1,2 then you can make anĮducated guess as to what it is trying to do. Is worth knowing what the numbers after DoMenuItem represent. When converting DoMenuItem to RunCommand, it
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |