Disable shortcut / right click on a form

Indigo

Registered User.
Local time
Today, 09:57
Joined
Nov 12, 2008
Messages
241
I have been searching for this solution all afternoon and have gotten nowhere. I am running Access 2010. I have added the following to the "On Open" event on my main form:

Code:
Private Sub Form_Open(Cancel As Integer)
    DoCmd.ShowToolbar "Ribbon", acToolbarNo
    DoCmd.NavigateTo "acNavigationCategoryObjectType"
    DoCmd.RunCommand acCmdWindowHide
    Me.ShortcutMenu = False
End Sub

My main form (frmMain) is displayed when the database opens. As you can see, I am hiding the ribbon and the navigation pane from users. I also want to prevent users from right clicking on the form and opening it in Design view - trying to prevent any monkey business. However, the line:

Me.ShortcutMenu = False

is not preventing users from right clicking on the form and getting the shortcut menu and going into Design view.

If I go to Options and uncheck: "Allow Default Shortcut Menus" then I lose the ability to print reports because I have the ribbon hidden and this will not allow right click on reports.

Converting to .accde is not an option at this time. Does anyone have any suggestions?
 
There are a couple of ways you can deal with this.

One way is to add an option group to your form with two options and a command button to perform the user selected choice. The first option would be "Preview" which when selected would allow the user to preview the report. The second option would be "Send to Printer". Use code in the OnClick event of the command button to determine the selected option and perform the desired action.

The other option is to uncheck the "Allow Default Shortcut Menus" option as you have already found and then create your own Menu designed specifically to be available when a report is displayed in preview mode. This menu would have the option to actually print the report Assign that Menu to your report in the properties of the report.

Hope this helps.

I have been searching for this solution all afternoon and have gotten nowhere. I am running Access 2010. I have added the following to the "On Open" event on my main form:

Code:
Private Sub Form_Open(Cancel As Integer)
    DoCmd.ShowToolbar "Ribbon", acToolbarNo
    DoCmd.NavigateTo "acNavigationCategoryObjectType"
    DoCmd.RunCommand acCmdWindowHide
    Me.ShortcutMenu = False
End Sub
My main form (frmMain) is displayed when the database opens. As you can see, I am hiding the ribbon and the navigation pane from users. I also want to prevent users from right clicking on the form and opening it in Design view - trying to prevent any monkey business. However, the line:

Me.ShortcutMenu = False

is not preventing users from right clicking on the form and getting the shortcut menu and going into Design view.

If I go to Options and uncheck: "Allow Default Shortcut Menus" then I lose the ability to print reports because I have the ribbon hidden and this will not allow right click on reports.

Converting to .accde is not an option at this time. Does anyone have any suggestions?
 

Users who are viewing this thread

Back
Top Bottom