Menubars
Apr 8, 2005
i have some forms, which i am creating customised menubar for them. On each menubar, i am planning to have options such as Add New Records, Delete, Exit Form etc. Now if i will create some general functions in a Module for each of the above, for example :
Function Add_Record()
DoCmd.GoToRecord , , acNewRec
End Function
and then place the function name on the onAction of a command button in the Menubar, will this be ok i.e. will it affect only the current form which has the focus (in case there are other forms opened will they be affected too?)
Moreover is it possible to set a background colour to a customised menubar, because i've seen it on a database, but i do not know how to do it.
Thank You for any advice/suggestions.
View Replies
Nov 22, 2005
The below code will hide ALL menu bars and ALL tool bars. Ensure that you have a way to unhide the menu bars and tool bars before you hide them! You should place the hide all tool bars routine in your opening splash screen form for it only needs to be run once when the db is first opened.
This will hide all menu bars and tool bars
Dim i As Integer
For i = 1 To CommandBars.Count
CommandBars(i).Enabled = False
Next i
This will unhide all menu bars and tool bars
Dim i As Integer
For i = 1 To CommandBars.Count
CommandBars(i).Enabled = True
Next i
An added bonus is the right-click mouse button option is disabled if the menu bars are disabled with the above code.
Use the 'ShowToolbar' command if you need to display a tool bar or menu bar...
DoCmd.ShowToolbar "YourToolBarNameHere", acToolbarYes
This will hide a tool bar or menu bar when needed...
DoCmd.ShowToolbar "YourToolBarNameHere", acToolbarNo
This will hide the menu bar...
DoCmd.ShowToolbar "Menu Bar", acToolbarNo
You can also hide/unhide the database window with code...
Hide the database window
DoCmd.SelectObject acTable, , True
DoCmd.RunCommand acCmdWindowHide
Unhide the database window
DoCmd.SelectObject acTable, , True
Remove the "Type a question for help" on the default menu bar in Access 2002 or 2003
Application.CommandBars.DisableAskAQuestionDropdow n = True
This command will prevent the db from opening up a separate window tab on the Taskbar
Application.SetOption "ShowWindowsinTaskbar", False
The above commands have been successfully tested with Access 97 and Access 2003.
Read this if you do not understand where to post your questions! >>> Please Read Before Posting (http://www.access-programmers.co.uk/forums/showthread.php?t=63576)
Please do not directly PM me with any questions related to my Hide all Access Toolbars and Menubars code. Please do not post any questions related to my Hide all Access Toolbars and Menubars code in the Code Repository forum. If you have a question related to the Hide all Access Toolbars and Menubars code... Please post your questions in the appropriate forum and include a link to this thread if you have a question or problem related to my Hide all Access Toolbars and Menubars code. I will be glad to help if I see your post and if I am available.
Key words: toolbars, tool bars, menubar, menu bars, hide, unhide, enable, disable, right click, right-click, database window, hide database window,
View 5 Replies
View Related