Can't get toolbar back

hmongie

Registered User.
Local time
Today, 01:53
Joined
May 17, 2003
Messages
99
Hi everyone. I need some help. I added this to my switchboard. Only problem is, I can turn it off. How can I get the tool bar back so that I can edit the codes? Any help would be appreciated.

code for on open, event procedure.

Private Sub Form_Open(Cancel As Integer)
Dim i As Integer
For i = 1 To CommandBars.Count
CommandBars(i).Enabled = False
Next i

' Minimize the database window and initialize the form.

' Move to the switchboard page that is marked as the default.
Me.Filter = "[ItemNumber] = 0 AND [Argument] = 'Default' "
Me.FilterOn = True

End Sub
 
I am guessing that you stumbled upon this code that I have posted on numerous threads. There is a reason that I added the warning "Ensure that you have a way to enable (unhide) the menu bars and tool bars (transparent command button) before you hide them!" You can easily copy the "enable" piece into a module and run it from there to restore your menu bars and tool bars.

The below code will disable (hide) all menu bars and tool bars. Ensure that you have a way to enable (unhide) the menu bars and tool bars (transparent command button) before you hide them!

'this will disable all menu bars and tool bars
Dim i As Integer
For i = 1 To CommandBars.Count
CommandBars(i).Enabled = False
Next i

'this will enable 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 option is disabled if the menu bars are disabled with the above code.

Use the 'ShowToolbar' command if you need to display a toolbar...
DoCmd.ShowToolbar "YourToolBarNameHere", acToolbarYes

This will hide a toolbar when needed...
DoCmd.ShowToolbar "YourToolBarNameHere", 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 Shift key will not affect [bypass] the disable/enable all menu bars and tool bars code.
 
Thanx

hehehehe... thanx, I must have skipped the important label. It didn't dawn onto me until after I had applied the codes. Silly me! I guess it must have been one of those days. Thanx anyhow, I will try your codes. Hopefully, my silly head won't do this again! :0)
 

Users who are viewing this thread

Back
Top Bottom