I use this code on a command button to hide and unhide navigation & the ribbon.
It works fine about 95% of the time.
When it does fail, it just closes the form (with no error message).
I think It only fails when hiding (I can't pin down the circumstances).
It never fails twice in a row.
Can anyone improve on the code?
Private Sub CommandHIDE_Click()
Static IsHidden As Boolean
If IsHidden Then
DoCmd.ShowToolbar "Ribbon", acToolbarYes
DoCmd.SelectObject acTable, , True
IsHidden = False
DoCmd.ShowToolbar "Ribbon", acToolbarNo
IsHidden = True