Results 1 to 4 of 4
  1. #1
    bbrazeau is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Sep 2011
    Posts
    101

    add filter commands to Shortcut or Right Click Menus


    Click image for larger version. 

Name:	ShortcutMenu.jpg 
Views:	10 
Size:	1.5 KB 
ID:	29369How do I put these 2 commands on a right click or shortcut menu on my form. Access 2007. Thank You

  2. #2
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Are you asking how to create a shortcut menu or how to add a filter to an existing one?

  3. #3
    bbrazeau is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Sep 2011
    Posts
    101
    I guess "add a filter to an existing one" I can create a short cut menu using 2 Macros as shown in several places I've searched, but what I wanted was a way to implement "Filter By Form", "Apply Filter", & "Clear all Filters" via the shortcut menu as opposed to the user having to mouse move up to the ribbon for each command. Thank You.

  4. #4
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    I don't know about macros. I found this VBA code which is called when the form is opened. It requires a reference to Microsoft Office Object Library.

    Code:
    Sub CreateShortcutMenuWithGroups()
     ' Create the shortcut menu.
        Dim cmbRightClick As Office.CommandBar
     
        On Error Resume Next
        CommandBars("cmdFormFiltering").Delete
        Set cmbRightClick = CommandBars.Add("cmdFormFiltering", msoBarPopup, False, True)
        
        With cmbRightClick
            '.Controls.Add msoControlButton, 141, , , True  'find
            '.Controls.Add msoControlButton, 19, , , True   'copy
            .Controls.Add(msoControlButton, 210, , , True).BeginGroup = True     'new group: sort asc
            .Controls.Add msoControlButton, 211, , , True                       'sort desc
             
            .Controls.Add(msoControlButton, 605, , , True).BeginGroup = True    'new group filter: clear filter
            .Controls.Add msoControlButton, 640, , , True       'Filter by Selection
            .Controls.Add msoControlButton, 3017, , , True      'Filter Excluding Selection
             
            .Controls.Add msoControlButton, 10077, , , True     'Filter equals xx
            .Controls.Add msoControlButton, 10078, , , True     'Filter not equal to xx
            .Controls.Add msoControlButton, 10079, , , True     'Filter beings with xx
            .Controls.Add msoControlButton, 12696, , , True     'Filter does not beings with xx
            .Controls.Add msoControlButton, 10080, , , True     'Filter contains xx
            .Controls.Add msoControlButton, 10081, , , True     'Filter does not contains xx
            .Controls.Add msoControlButton, 10082, , , True     'Filter ends with xx
            .Controls.Add msoControlButton, 10083, , , True     'Filter ends with xx
            .Controls.Add msoControlButton, 12697, , , True     'Filter does not ends with xx
            .Controls.Add msoControlButton, 10062, , , True     'between
        End With
     
    Set cmbRightClick = Nothing
    End Sub

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 0
    Last Post: 12-13-2014, 09:23 PM
  2. Another question regarding shortcut menus
    By lawdy in forum Programming
    Replies: 2
    Last Post: 05-27-2014, 04:25 PM
  3. Replies: 5
    Last Post: 03-15-2014, 05:27 PM
  4. Shortcut menus in A2010
    By John_G in forum Access
    Replies: 1
    Last Post: 12-03-2013, 02:52 PM
  5. Removing Shortcut menus on tables.
    By Desstro in forum Access
    Replies: 4
    Last Post: 11-04-2010, 12:19 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums