• Make a menu load after a form executes? (97)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Make a menu load after a form executes? (97)

    Author
    Topic
    #364315

    Make a menu load after a form executes?
    I created my own menu bar. I also created my own password login form. If I don

    Viewing 0 reply threads
    Author
    Replies
    • #558878

      You can use the DoCmd.ShowToolbar code. You use acToolbarNo to hide menus and toolbars and acToolbarYes to show menus and toolbars. It confused me because I thought there would be a ShowMenu command, but there isn’t. Menus and Toolbars are the same, as far as the ShowToolbar command is concerned.

      I use the following code on the FormOpen event to hide all toolbars. This way, users can only use what I let them use. I have a switchboard-like form that provides forms, queries and reports that users need.

      Private Sub Form_Open(Cancel As Integer)

      DoCmd.ShowToolbar “Database”, acToolbarNo ‘hides the database window’
      DoCmd.ShowToolbar “Web”, acToolbarNo ‘hides the Web toolbar’
      DoCmd.ShowToolbar “Form View”, acToolbarNo ‘hides the Form View toolbar
      DoCmd.ShowToolbar “Menu Bar”, acToolbarNo ‘hides the Menu Bar (the built in menu bar with File — Help)’
      DoCmd.ShowToolbar “MyMenu”, acToolbarNo ‘hides the menu I made’
      cmdBClose.Visible = False ‘hides the Close button that contains the code below’

      End Sub

      I have a Close button on the opening form that has the following code in the OnClick event to turn on toolbars that I want to see. This command button is only visible to my password.

      Private Sub cmdBClose_Click()
      On Error GoTo Err_cmdBClose_Click

      DoCmd.SelectObject acTable, , True ‘shows the Database window and selects the Table tab’
      DoCmd.ShowToolbar “Database”, acToolbarYes
      DoCmd.ShowToolbar “MyMenu”, acToolbarYes
      DoCmd.ShowToolbar “Form View”, acToolbarYes
      DoCmd.ShowToolbar “Menu Bar”, acToolbarYes
      DoCmd.Close

      Exit_cmdBClose_Click:
      Exit Sub

      Err_cmdBClose_Click:
      MsgBox Err.Description
      Resume Exit_cmdBClose_Click

      End Sub

      You should probably be able to rig up something like this for your needs.

    Viewing 0 reply threads
    Reply To: Make a menu load after a form executes? (97)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: