Re: looping through toolbars




Yes, it is bombing on this line:
--> DoCmd.ShowToolbar strToolbar, acToolbarNo

Her is my code:
'Set Microsoft DAO 3.6 Object Library" in Tools/References
Dim dbs As Database
Set dbs = CurrentDb
Dim intlooper As Integer

For intlooper = 1 To CommandBars.Count
If CommandBars(intlooper).Name <> "Menu bar" Then
DoCmd.ShowToolbar strToolbar, acToolbarNo 'hide it
Debug.Print "Hiding " & _
CommandBars(intlooper).Name & " equals "_
acToolbarNo/False"
End If
Next intlooper

- - -

When VBA hits the line I referenced above, at this point Access 2002
crashes and I have to restart it.
To get around it, I have to reference each one individually, thus:

DoCmd.ShowToolbar "Form View", acToolbarNo
DoCmd.ShowToolbar "Task Pane", acToolbarNo
DoCmd.ShowToolbar "Database", acToolbarNo
DoCmd.ShowToolbar "Menu Bar", acToolbarNo
DoCmd.ShowToolbar "Print Preview", acToolbarNo
....etc...for all of them.

My bottom line target solution would be to turn off ALL toolbars in my
app and only show my customized toolbar (that does not have a Database
Window icon in it)

If anyone has a better way, let me know (that doesn't crash an Access
2002-SP3 development platform)


----------
"Perseverance - there is no substitute for hard work."
- Thomas Alva Edison

*** Sent via Developersdex http://www.developersdex.com ***
.



Relevant Pages

  • Re: Access 2007 toolbars
    ... My problem is that i haven't created any custom toolbars. ... DoCmd.ShowToolbar "Menu Bar", acToolbarWhereApprop ... DoCmd.ShowToolbar "Database", acToolbarWhereApprop ... DoCmd.ShowToolbar "Menu Bar", acToolbarNo ...
    (microsoft.public.access.formscoding)
  • Re: Access 2007 toolbars
    ... If CurrentUser= "Owner" Then ... DoCmd.ShowToolbar "Menu Bar", acToolbarWhereApprop ... DoCmd.ShowToolbar "Database", acToolbarWhereApprop ... DoCmd.ShowToolbar "Menu Bar", acToolbarNo ...
    (microsoft.public.access.formscoding)
  • Access 2007 toolbars
    ... Access 2007 Toolbars ... DoCmd.ShowToolbar "Menu Bar", acToolbarWhereApprop ... DoCmd.ShowToolbar "Database", acToolbarWhereApprop ... DoCmd.ShowToolbar "Menu Bar", acToolbarNo ...
    (microsoft.public.access.formscoding)
  • Run Code every Time any form is loaded in the database.
    ... without adding code to every form in my database. ... DoCmd.ShowToolbar "NoMenu", acToolbarNo ... Thanking everyone in anticipation. ...
    (microsoft.public.access.formscoding)

Loading