Solved

List of Access 2010 Shortcut Menu 'Magic' numbers

Posted on 2013-11-17
3
3,402 Views
Last Modified: 2013-11-17
I [previously posted a question asking how to create 'shortcut menus' in Access 2010 since the menu builder in Access 2003 was no longer available.  I got an excellent answer that works but it leads me to another question.  In the example the Cut, Copy and Paste options are added using the 'magic number' (21=Cut, 19=Copy, 22=Paste) technique.

There are many other built in Access functions that I would like to include in my menu's.  For example my shortcut menu on a report would have 'Print', 'Export' and possibly 'Email as an Attachment' options.  What are the magic numbers for these functions?

More generally where can I find a list of the magic numbers for Access functions?

Here is the code in the example I was given:
Public Function CreateCMenu()
On Error Resume Next

    CommandBars("MyContext").Delete

    Dim cmb As CommandBar 'Object
    Dim cmbBtn1 As CommandBarButton 'Object
    Dim cmbBtn2 As CommandBarButton 'Object

    Set cmb = CommandBars.Add("MyContext", _
               msoBarPopup, False, False)    ' msoBarPopup = 5
        With cmb
              ' add cut, copy, and paste buttons with the "magic number" technique that assigns
              ' appearance and behavior. The magic number goes in as the second parameter

            .Controls.Add msoControlButton, _
                  21, , , True  ' 21=Cut, msoControlButton=1
            .Controls.Add msoControlButton, _
                      19, , , True  '19= Copy
            .Controls.Add msoControlButton, _
                      22, , , True  ' 22=Paste

' add customized buttons with our caption and function name -- second param is blank
            Set cmbBtn1 = .Controls.Add(msoControlButton, _
                                    , , , True)
            With cmbBtn1
                .BeginGroup = True
                .Caption = "Create New"
                .OnAction = "=CreateNewOrder()"
                .FaceID = 59  'smiley face
            End With
           
            Set cmbBtn2 = .Controls.Add(msoControlButton, _
                                    , , , True)
            With cmbBtn2
                .Caption = "Reset"
                .OnAction = "=ClearOrder()"
            End With
        End With

   
End Function

Open in new window

0
Comment
Question by:mlcktmguy
  • 2
3 Comments
 
LVL 26

Accepted Solution

by:
MacroShadow earned 250 total points
ID: 39654695
Download the file at http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=6627 once extracted, you will find what you're looking in an Excel file named AccessControls
0
 
LVL 1

Author Comment

by:mlcktmguy
ID: 39654979
Thank you.  I found all that I was looking for except 'Export..."  In Access 2003 this menu option would pop up a new menu listing all the export formats to choose from.

I found specific exports "Export Excel', 'Export Word' etc.. but nothing similar to the old option.  Maybe it doesn't exist in the new version of Access.  If by chance you know what the numeric equivalent is, please let me know.

In case anyone else is interested, these are the ones I found in the list and put into a right click menu that users will see when a report is previewed.

            .Controls.Add msoControlButton, _
                      15948, , , True  ' 15948  - Print... with Dialog menu
            .Controls.Add msoControlButton, _
                      2521, , , True  ' 2521  - File Print Quick
                     
             .Controls.Add msoControlButton, _
                      12951, , , True  ' 12951 - Publish to PDF or EDoc
                 
     
            .Controls.Add msoControlButton, _
                      11723, , , True  ' 11723  Export To Excel
            .Controls.Add msoControlButton, _
                      11725, , , True  ' 11725 - Export to Word                      
            .Controls.Add msoControlButton, _
                      2188, , , True  ' 2188 File Send as attachment
0
 
LVL 1

Author Closing Comment

by:mlcktmguy
ID: 39654980
Excellent
0

Featured Post

Free Gift Card with Acronis Backup Purchase!

Backup any data in any location: local and remote systems, physical and virtual servers, private and public clouds, Macs and PCs, tablets and mobile devices, & more! For limited time only, buy any Acronis backup products and get a FREE Amazon/Best Buy gift card worth up to $200!

Join & Write a Comment

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now