yes, just add this code to whatever event you use to test for the condition. You need to know the name of the MenuBar and the Name or Caption of the Item on the MenuBar.
Dim cbr As CommandBar
Dim cbrCtl As CommandBarControl
' Set a reference to the Access menu bar
Set cbr = CommandBars("CommandBarName"
Set cbrCtl = cbr.Controls("CommandBarCaptionGoesHere"
' Set the Enabled Property to False
cbrCtl.Enabled = False
'or set it to True
' cbrCtl.Enabled = True
How can I then enable/disable only one item from the drop down list of a menu on a menubar?
For example:
I have a menu bar named "MenuBarName" with a caption named "Caption" and then I have another caption I guess named "SubCaption" that appears as one of many items in the "Caption"
MenuBarName>Caption>Subcaption
I have tried experimenting with this but might not be on the right track. Is there a SubControls or something?
Private Sub form_load()
Dim cbr As CommandBar
Dim cbrCtl As CommandBarControl
' Set a reference to the Access menu bar
Set cbr = CommandBars("menubar"
Set cbrCtl = cbr.Controls("menucaption".Controls("submenucaption"
' Set the Enabled Property to False
cbrCtl.Enabled = True
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.