Thursday, February 18, 2016

Hide Options Menu from Backstage

There have been a couple of times when users in the forums asked how to hide the backstage menu, specifically Options, to prevent their users from making adjustments to the database settings. When a database application is executed in a runtime environment, most of the menus are disabled; but sometimes, that is not enough to protect the database from curious users. One possible approach is to create a custom Ribbon that manipulates the Backstage to hide these menus.

Figure 1 shows a typical Access 2010 File Menu (Backstage) with all the choices available.



Figure 2 shows what the File Menu might look like after applying the custom Ribbon that manipulates the Backstage.



To achieve the result shown in Figure 2, just include the following XML snippet within your custom Ribbon.
<backstage>
  <button idMso="FileSave" visible="false"/>
  <button idMso="SaveObjectAs" visible="false"/>
  <button idMso="FileSaveAsCurrentFileFormat" visible="false"/>
  <button idMso="FileOpen" visible="false"/>
  <button idMso="FileCloseDatabase" visible="false"/>
  <tab idMso ="TabInfo" visible="false"/>
  <tab idMso ="TabRecent" visible="false"/>
  <tab idMso ="TabNew" visible="false"/>
  <tab idMso ="TabPrint" visible="false"/>
  <tab idMso ="TabShare" visible="false"/>
  <tab idMso ="TabHelp" visible="false"/>
  <button idMso="ApplicationOptionsDialog" visible="false"/>
  <button idMso="FileExit" visible="false"/>
</backstage>
To see this in action, please download the demo file here. As usual, I would appreciate any comments or feedback. Thank you.

Original post date: September 30, 2014

6 comments:

  1. Tried to download demo file and get "not found" error.

    ReplyDelete
    Replies
    1. Hi. Sorry about that. The link was broken but it's fixed now. Please try again. Thank you.

      Delete
  2. Hi. Nice job.

    Is there any way of making the controls visible/invisible depending on a user's access permissions?

    ReplyDelete
    Replies
    1. Hi. Yes there is a way to hide or show ribbon controls by using the GetVisible callback. Check out this website for an example: https://www.accessribbon.de/en/?Access_-_Ribbons:Callbacks:getVisible

      Delete
  3. Sorry I should have been clearer. I was meaning the Backstage controls. When I try to use GetVisible on say "TabInfo", I get "Callback functions cannot be specified on built-in controls". After much googling, this apparently is the way it's designed to work. I was hoping you had an alternate method?

    ReplyDelete
    Replies
    1. Ah, I see. I haven't tried it yet; but if this is not possible, then the only way I could think of trying right now is to create a separate Ribbon XML per user permission. You load the basic one first to avoid any errors and after you determined the user's permission, you can try loading the correct ribbon XML from the XML table. Just my 2 cents...

      Delete