I presently disable all menus and selectively enable cutomized menu icons as necessary. A user has requested that in addition to a cutom Copy/Paste toolbar, I enable the right mouse button. I wanted to disable the right mouse button on purpose to prevent users from entering Design mode of a form. Any hints to accomplish enableing right muse button for Copy/Paste only are appreciated.
Below is code I am presently using and other references I previously found...
'Hide all menu bars and tool bars
Dim i As Integer
For i = 1 To CommandBars.Count
CommandBars(i).Enabled = False
Next i
'Unhide all menu bars and tool bars
Dim i As Integer
For i = 1 To CommandBars.Count
CommandBars(i).Enabled = True
Next i
'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
The above commands have been successfully tested with Access 97 and Access 2003.
============================================
Steve Medvid
"IT Consultant & Web Master"
Chester County, PA Residents
Please Show Your Support...
Below is code I am presently using and other references I previously found...
'Hide all menu bars and tool bars
Dim i As Integer
For i = 1 To CommandBars.Count
CommandBars(i).Enabled = False
Next i
'Unhide all menu bars and tool bars
Dim i As Integer
For i = 1 To CommandBars.Count
CommandBars(i).Enabled = True
Next i
'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
The above commands have been successfully tested with Access 97 and Access 2003.
============================================
Steve Medvid
"IT Consultant & Web Master"
Chester County, PA Residents
Please Show Your Support...