Custom Menu Bars

darthcalis

Registered User.
Local time
Today, 19:22
Joined
Mar 20, 2012
Messages
17
Hello All,

I'm having a bit of trouble getting exactly what I want with regard to a custom menu bar which pops up on a continuous form when I right click. I may have to deploy the app I'm building with Access 2010 Runtime and I know you don't get the sort & filter menus by default which is why I'm looking at the custom menu bars. I have an initial small bit of code which I swiped from Access online help ( :) ) which works just fine as shown below:

Code:
Sub CreateShortcutMenuWithGroups() 
    Dim cmbRightClick As Office.CommandBar 
 
 ' Create the shortcut menu. 
    Set cmbRightClick = CommandBars.Add("cmdFormFiltering", msoBarPopup, False, True) 
     
    With cmbRightClick 
        ' Add the Find command. 
        .Controls.Add msoControlButton, 141, , , True 
         
        ' Start a new grouping and add the Sort Ascending command. 
        .Controls.Add(msoControlButton, 210, , , True).BeginGroup = True 
         
        ' Add the Sort Descending command. 
        .Controls.Add msoControlButton, 211, , , True 
         
        ' Start a new grouping and add the Remove Filer/Sort command. 
        .Controls.Add(msoControlButton, 605, , , True).BeginGroup = True 
         
        ' Add the Filter by Selection command. 
        .Controls.Add msoControlButton, 640, , , True 
         
        ' Add the Filter Excluding Selection command. 
        .Controls.Add msoControlButton, 3017, , , True 
         
        ' Add the Between... command. 
        .Controls.Add msoControlButton, 10062, , , True 
    End With 
 
Set cmbRightClick = Nothing 
End Sub

I have 2 problems though. First, I want to have a popup / flyout menu come off the main menu like you get with the default sort / filter options when you right click which gives access to additional filter options, such as the date options to filter by 'Today' / 'Yesterday', etc. I would think that I need to add an msoControlPopup or msoControlDropdown rather than msoControlButton to get this functionality, but I can't get it to work, and I'm not getting very far with Access help.

Second problem, are there IDs for the field specific filter options such as Today / Yesterday / Quarter 1 / Quarter 2, etc? I have the complete ID list that I downloaded from Microsoft, but it doesn't appear to have these IDs. Do they exist or can they not be added? Or is there perhaps just a menu I need to add which contains all these options already?

Cheers,
Emilio
 

Users who are viewing this thread

Back
Top Bottom