micsak
10-08-2003, 03:15 AM
I want to create my command Bar with my menus and my buttons in Ms Access.
Can you help me?
Regards
Michael
Can you help me?
Regards
Michael
|
View Full Version : Command Bar with menu and button in Access micsak 10-08-2003, 03:15 AM I want to create my command Bar with my menus and my buttons in Ms Access. Can you help me? Regards Michael Mile-O 10-08-2003, 03:31 AM Access 97 (http://support.microsoft.com/default.aspx?scid=kb;en-us;159692&Product=acc) Access 2000 (http://support.microsoft.com/default.aspx?scid=kb;en-us;209974&Product=acc) Access 2002 (http://support.microsoft.com/default.aspx?scid=kb;en-us;306369&Product=acc) namliam 10-08-2003, 03:31 AM < Question: I want a db.... how do i create it? > Hmz, Ok i will bite.... View => Toolbars => Customize Regards micsak 10-08-2003, 04:38 AM Private Sub cmdCreateFullBar_Click() Dim MyButton As CommandBarButton Dim MyBar As CommandBar Dim cbmCommandBarMenu As CommandBar Dim cbmMenu1 As CommandBarPopup Dim cbmMenu2 As CommandBarPopup Dim cbmCommandBarMenuCascade As CommandBarPopup Application.CommandBars("OfficeMenubar").Delete Set MyBar = Application.CommandBars.Add("OfficeMenubar", msoBarTop, True) With Application.CommandBars("OfficeMenubar") Set MyButton = .Controls.Add .Visible = True .Position = msoBarTop End With With MyBar.Controls Set cbmMenu1 = _ .Add(Type:=msoControlPopup, Before:=1) ' Set caption for new menu. With cbmMenu1 .Caption = "Menu1 Caption" ' Add single menu item and set properties. With .Controls.Add(msoControlButton) .OnAction = "DisplayMessage" .Caption = "Demo &Menu Item" .Tag = "DemoMenuItem" End With End With End With With MyBar.Controls Set cbmMenu2 = _ .Add(Type:=msoControlPopup, Before:=2) ' Set caption for new menu. With cbmMenu2 .Caption = "Menu2 Caption" ' Add single menu item and set properties. With .Controls.Add(msoControlButton) .OnAction = "DisplayMessage" .Caption = "Menu Item1" .Tag = "MenuItem1" End With With .Controls.Add(msoControlButton) .OnAction = "DisplayMessage" .Caption = "Menu Item2" .Tag = "MenuItem2" End With End With Set cbmCommandBarMenuCascade = _ cbmMenu1.Controls.Add(msoControlPopup) With cbmCommandBarMenuCascade .Caption = "Cascade1" ' Add first cascading menu item and set properties. With .Controls.Add(msoControlButton) .Caption = "&Button1" .OnAction = "DisplayMessage" .Tag = "Button 1" End With ' Add second cascading menu item and set properties With .Controls.Add(msoControlButton) .Caption = "Button 2" .OnAction = "DisplayMessage" .Tag = "Button 2" End With End With Set cbmCommandBarMenuCascade = _ cbmMenu2.Controls.Add(msoControlPopup) With cbmCommandBarMenuCascade .Caption = "Cascade2" ' Add first cascading menu item and set properties. With .Controls.Add(msoControlButton) .Caption = "&Button3" .OnAction = "DisplayMessage" .Tag = "Button 3" End With ' Add second cascading menu item and set properties With .Controls.Add(msoControlButton) .Caption = "Button 4" .OnAction = "DisplayMessage" .Tag = "Button 4" End With End With End With Mile-O 10-08-2003, 06:39 AM micsak, was a question supposed to be attached that piece of code or were you just posting the code for another reason? micsak 10-09-2003, 03:21 AM I had initially this question and when I found the solution I just posted for reference. Thanks Michael |