Create a Form with No Menu or Toolbar

Problem

You’d like to completely disable menus for a form, and the toolbar too. Is there any way to remove menus and toolbars from a form?

Solution

If you set the MenuBar property of a form to point to a macro in Access that contains no macro actions, you can trick Access into not displaying any menus. This solution demonstrates this trick and also discusses how you can apply it to the global menus of an application. In addition, you’ll learn how to use VBA code to remove a form’s toolbar.

To create forms in your database without any menus, follow these steps:

  1. Create a new macro sheet without any actions. The mcrNoMenus macro sheet in 09-02.MDB has no macro actions.

  2. Create a new form or open an existing form in design view. Select the menu macro from Step 1 as the MenuBar property for the form.

  3. Add the following Activate and Deactivate event procedures to the form to remove the toolbar for this form only:

    Private Sub Form_Activate(  )
     DoCmd.ShowToolbar "Form View", acToolbarNo
    End Sub
    
    Private Sub Form_Deactivate(  )
     DoCmd.ShowToolbar "Form View", acToolbarWhereApprop
    End Sub
  4. Optionally, you may wish to also eliminate right-click shortcut menus for your form. To do this, set the ShortcutMenuBar property of the form to No.

  5. Save the form.

To see an example, load the 09-02.MDB sample database. Open the frmCustomerDefaultMenus form in form view and note that the default Access menu and toolbar are available at the top of the screen (see Figure ...

Get Access Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.