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
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
Try:
Dim MyMenu As Object
Set MyMenu = CommandBars("Main").Controls("Menu1")
MyMenu.Controls(0).Visible = False
on which event should i put this code ruralguy?
I usually open an invisible form with the AutoExec macro and use the OnLoad and OnUnload events for housekeeping chores.
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.
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.
You did not post the correct names for the CommandBars. Try this db. The button is a toggle.
MyMenu.Controls(1).Visible = Not MyMenu.Controls(1).Visible
what does that line says?
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?
I don't really know. You will just have to play with the collection. Google might help here as well.
ok thanks. the code works fine. i will play with it. thanks again.
You're welcome. Have fun.