MS Access 2010 Runtime - Missing Right Mouse Click Context Menu in continuous forms

user1107679 picture user1107679 · Dec 20, 2011 · Viewed 9.5k times · Source

I have written an application in MS Access 2003. I can run this using Access 2010, however when I open the same 2003 application with the MS Access 2010 Runtime only, I can no longer use the Right Mouse Click in a continuous form (as I can with the full version) to filter by selection or to sort data etc. Has anyone else encountered this situation? Is this a purposeful design of Access 2010? If so, does anyone know why the Right-Click Content Menu is not working? Otherwise - is it a normal part of the Runtime 2010 and my application is the problem?

Answer

Renaud Bompuis picture Renaud Bompuis · Mar 20, 2012

The Runtime unfortunately doesn't have context menu enabled, however, you can re-create some of it for your application.

For instance, in mine, I create a basic copy/cut/paste context menu like this:

'-----------------------------------------------------------------------------'
' General Clipboard context menu, the basis for all forms                     '
'-----------------------------------------------------------------------------'
Public Function CreateGeneralClipBoardMenu()
    On Error Resume Next
    CommandBars("GeneralClipboardMenu").Delete

    Dim cmb As CommandBar
    Set cmb = CommandBars.Add("GeneralClipboardMenu", msoBarPopup, False, False)

        With cmb
            .Controls.Add msoControlButton, 21, , , True  ' Cut
            .Controls.Add msoControlButton, 19, , , True  ' Copy
            .Controls.Add msoControlButton, 22, , , True  ' Paste
        End With

    Set cmb = Nothing
End Function

Just call this code once at the start of your application and the context menu will be available everywhere.

The Need a list of msoControlButton Ids thread on MSDN shows how to similarly add Sorting and filter options.