Results 1 to 9 of 9
  1. #1
    Join Date
    Feb 2013
    Posts
    14

    Unanswered: Right Click shortcut menu

    I have taken this code from the Microsoft pages in order to create a custom shortcut menu.

    Can someone please explain step by step what I need to do with it:

    Sub CreateSimpleShortcutMenu()
    Dim cmbShortcutMenu As Office.CommandBar

    ' Create a shortcut menu named "SimpleShortcutMenu.
    Set cmbShortcutMenu = CommandBars.Add("SimpleShortcutMenu", msoBarPopup, False, True)

    ' Add the Remove Filter/Sort command.
    cmbShortcutMenu.Controls.Add Type:=msoControlButton, Id:=605

    ' Add the Filter By Selection command.
    cmbShortcutMenu.Controls.Add Type:=msoControlButton, Id:=640

    Set cmbShortcutMenu = Nothing

    End Sub

    Basically, I want all of the filter and order items to be available but not the layout or design items.

  2. #2
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    Simply assign the name "SimpleShortcutMenu" to the ShortcutMenuBar property of the form on which you want to use it.
    Have a nice day!

  3. #3
    Join Date
    Feb 2013
    Posts
    14

    Right Click shortcut menu

    Hi all

    Can someone offer a simple way of achieving a customized shortcut menu when viewing forms in MS Access 2013.

    When the user Right Clicks the mouse, all I want them to see are the following commands:

    Order by
    Filter by

    How can I achieve this please?

    Thanks
    Gary
    Last edited by Gary1008; 05-22-14 at 04:28.

  4. #4
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    please do not start multiple threads on the same topic. its fien to ***BUMP*** a thread if its not got an answer. its fine to rephrase your question if you don't get an answer that works for you
    I'd rather be riding on the Tiger 800 or the Norton

  5. #5
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    What's the problem?

    - You first posted a message explaining that you had created a popup (shortcut) menu and you asked how to use it with a form. I answered that.

    - Now you ask how to build a shortcut menu. What is it? What does (or does not) work?
    Have a nice day!

  6. #6
    Join Date
    Feb 2013
    Posts
    14
    Ok sorry about that

    When I run the form and perform a Right Click, an error box appears stating:

    The Corrective Action DB cannot find the object 'SimpleShortcutMenu'

    I have checked the spelling and it is correct.

    Any advice please?

  7. #7
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    1. First chack that the popup menu was actually created:
    Code:
    Sub EnumCmdBars()
    
        Dim cmbShortcutMenu As Office.CommandBar
        
        For Each cmbShortcutMenu In Application.CommandBars
            Debug.Print cmbShortcutMenu.Name
        Next cmbShortcutMenu
        
    End Sub
    The attached picture represents a form with its ShortcutMenuBar property set to "SimpleShortcutMenu".
    Attached Thumbnails Attached Thumbnails ShortcutMenu.jpg  
    Have a nice day!

  8. #8
    Join Date
    Feb 2013
    Posts
    14
    How do I create the pop up menu?

  9. #9
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    With the procedure you first posted:
    Code:
    Sub CreateSimpleShortcutMenu()
    
        Dim cmbShortcutMenu As Office.CommandBar
        
        ' Create a shortcut menu named "SimpleShortcutMenu.
        Set cmbShortcutMenu = CommandBars.Add("SimpleShortcutMenu", msoBarPopup, False, True)
        
        ' Add the Remove Filter/Sort command.
        cmbShortcutMenu.Controls.Add Type:=msoControlButton, Id:=605
        
        ' Add the Filter By Selection command.
        cmbShortcutMenu.Controls.Add Type:=msoControlButton, Id:=640
        
        Set cmbShortcutMenu = Nothing
    
    End Sub
    Have a nice day!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •