Results 1 to 2 of 2
  1. #1
    4 Star Lounger
    Join Date
    Jun 2001
    Posts
    531
    Thanks
    0
    Thanked 0 Times in 0 Posts

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

    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

  2. #2
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Indiana, USA
    Posts
    107
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Make a menu load after a form executes? (97)

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •