Hide and show toolbars

S

Sam Kuo

Q1. I use the following codes to hide both Menu Bar (File, Edit, View, ect)
and Form View toolbar, when the startup form opens:

Private Sub Form_Load()
DoCmd.ShowToolbar "Menu Bar", acToolbarNo
CommandBars("Form View").Visible = False
End Sub

This works fine so far. But then I wish to have both toolbars reappear when
the next form opens (and hide again when back to 1st form) so I use the
following codes in 2nd form:

DoCmd.ShowToolbar "Menu Bar", acToolbarYes
CommandBars("Form View").Visible = True

But this doesn't seem to work. What have I done wrong? Many thanks
 
S

Sam Kuo

just to make the problem clearer, those codes used to unhide both toolbars do
not work only when the 2nd form contains pages/tabs. Within each page there
is a subform. The codes look like:

Private Sub Form_Load()
' This is what I just added to unhide both toolbars
DoCmd.ShowToolbar "Menu Bar", acToolbarYes
CommandBars("Form View").Visible = True

' Create an instance of our FormatByCriteria class
Set TB = New cls2ndform

' You MUST set the CriteriaControl prop
' Set the first TAB Page as the current page
Me.TabCtl.Value = 0
TB.TabControl = Me.TabCtl

' You MUST set the BackGround control
' used to display the current pages background color
TB.BGControl = Me.RecBG
' Parent Form
TB.TabForm = Me

' Set the desired Rotation amount
' For this class it should remain at Zero as
' the class only renders the Text when it is colored.
TB.RotateDegree = 0

' Create the Tabs
' For this sample we only want the Current TAB itself colored
' not the background of the TAB control.
TB.ColorTabsOnly = True
TB.MakeTabsCurrentPage Me.TabCtl.Value

End Sub

Private Sub Form_Unload(Cancel As Integer)
Set TB = Nothing
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top