问题
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?
回答1:
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.
回答2:
The standard context menus do not work with the Access runtime version. I have seen this effect with Access runtime versions 2003, 2007 and 2010.
来源:https://stackoverflow.com/questions/8574642/ms-access-2010-runtime-missing-right-mouse-click-context-menu-in-continuous-fo