Results 1 to 14 of 14
  1. #1
    marianne is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Mar 2009
    Location
    Asia Pacific Region
    Posts
    150

    customized menu bar


    hi, I have made a custom menu bar for my program. for example, I have two sub-menu bar named menu1 and menu2 on my main menubar named "main".

    How can I hide the sub-menu bar named "menu1" using the codes? tnx

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Try:
    Dim MyMenu As Object
    Set MyMenu = CommandBars("Main").Controls("Menu1")
    MyMenu.Controls(0).Visible = False

  3. #3
    marianne is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Mar 2009
    Location
    Asia Pacific Region
    Posts
    150
    on which event should i put this code ruralguy?

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    I usually open an invisible form with the AutoExec macro and use the OnLoad and OnUnload events for housekeeping chores.

  5. #5
    marianne is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Mar 2009
    Location
    Asia Pacific Region
    Posts
    150
    i tried the code you gave me on On_click event so I can study how the code works. but it didn't work? where have I gone wrong?

    I have attached herewith the file I am working with. maybe you can see it. it is access 2000 version. thanks alot for the replies.

  6. #6
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Quote Originally Posted by marianne View Post
    i tried the code you gave me on On_click event so I can study how the code works. but it didn't work? where have I gone wrong?
    What OnClick event?

  7. #7
    marianne is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Mar 2009
    Location
    Asia Pacific Region
    Posts
    150
    I have made a form and command button for it. and I put the code on the on_click event of the command button just so I can study how the code works.

  8. #8
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    You did not post the correct names for the CommandBars. Try this db. The button is a toggle.

  9. #9
    marianne is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Mar 2009
    Location
    Asia Pacific Region
    Posts
    150
    MyMenu.Controls(1).Visible = Not MyMenu.Controls(1).Visible

    what does that line says?

  10. #10
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Quote Originally Posted by marianne View Post
    MyMenu.Controls(1).Visible = Not MyMenu.Controls(1).Visible

    what does that line says?
    It says toggle the visibility of that control. Every time you run the code the visibility will switch.

  11. #11
    marianne is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Mar 2009
    Location
    Asia Pacific Region
    Posts
    150
    ok. the number "1" specifies the top most control, then "2" then "3" and so on and so forth going to the bottom? im a thinking it correctly? how about if menu1 has sub-menu named menu1a, how will the code go?

  12. #12
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    I don't really know. You will just have to play with the collection. Google might help here as well.

  13. #13
    marianne is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Mar 2009
    Location
    Asia Pacific Region
    Posts
    150
    ok thanks. the code works fine. i will play with it. thanks again.

  14. #14
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    You're welcome. Have fun.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. On click menu items do not work
    By mrk68 in forum Access
    Replies: 1
    Last Post: 03-23-2009, 07:29 PM
  2. Click menu dish to show it's ingredients
    By elfsareus in forum Access
    Replies: 7
    Last Post: 12-16-2008, 10:10 PM
  3. Startup Menu Greyed Out
    By slash75 in forum Access
    Replies: 0
    Last Post: 02-14-2007, 04:55 PM
  4. Customized Format for displaying record
    By wasim_sono in forum Reports
    Replies: 1
    Last Post: 10-10-2006, 09:27 PM
  5. How about creating a drop down menu in a report?
    By beastmaster in forum Access
    Replies: 2
    Last Post: 12-29-2005, 01:01 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums