Hello, how can I programmatically hide all my custom toolbars without having
to specify each toolbar name? In my database, I am showing toolbars based on
the user credential, (Admin, user, guest, etc.)
I know I can do this:
If Me.GroupID = 1 Then
DoCmd.ShowToolbar "GuestToolbar", acToolbarNo
DoCmd.ShowToolbar "UserToolbar", acToolbarNo
DoCmd.ShowToolbar "AdminToolbar", acToolbarYes
Exit Sub
End If
But, instead of having to specify all the toolbar names to hide (in this
example I have used "GuestToolbar" and UserToolbar) I would like to hide all
of them regardless of the name, and at the end display only the one I want
(In this example "AdminToolbar"). I guess should be something like:
DoCmd.ShowToolbar "*", acToolbarNo
DoCmd.ShowToolbar "AdminToolbar", acToolbarYes
Thank you,
Silvio
Alex Dybenko - 31 Dec 2006 17:52 GMT
Hi,
perhaps something like this:
dim cmb as commandbar
for each cmb in commandbars
if not cmb.BuiltIn then
cmd.visible=false
end if
next

Signature
Best regards,
___________
Alex Dybenko (MVP)
http://alexdyb.blogspot.com
http://www.PointLtd.com
> Hello, how can I programmatically hide all my custom toolbars without
> having
[quoted text clipped - 22 lines]
> Thank you,
> Silvio
Silvio - 31 Dec 2006 18:29 GMT
Alex: I am getting a "User-defined type not defined" error message when
compiling
for the line: Dim cmb As CommandBars
Any other idea?
Thank you,
Silvio
> Hi,
> perhaps something like this:
[quoted text clipped - 33 lines]
> > Thank you,
> > Silvio
Douglas J. Steele - 31 Dec 2006 18:34 GMT
You need to add a reference to the appropriate Office library (Microsoft
Office n.0 Object Library, where n is 8 for Access 97, 9 for Access 2000 or
10 for Access 2002, 11 for Access 2003)
Note, too, that Alex said to use
dim cmb as commandbar
not
dim cmb as commandbars

Signature
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)
> Alex: I am getting a "User-defined type not defined" error message when
> compiling
[quoted text clipped - 46 lines]
>> > Thank you,
>> > Silvio
Silvio - 31 Dec 2006 19:01 GMT
Even using commandbar instead of commandbars I am getting the same message. I
am using Access 2003. How do I add a reference to the appropriate Office
library? I ahve no idea what you talking about sorry. My access programming
experience is limited.
> You need to add a reference to the appropriate Office library (Microsoft
> Office n.0 Object Library, where n is 8 for Access 97, 9 for Access 2000 or
[quoted text clipped - 58 lines]
> >> > Thank you,
> >> > Silvio
Douglas J. Steele - 31 Dec 2006 20:24 GMT
Go into the VB Editor, and select Tools | References from the menu bar.
Scroll through the list of available references until you find the reference
Microsoft Office 11.0 Object Library, select it, and click OK to exit the
dialog.

Signature
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)
> Even using commandbar instead of commandbars I am getting the same
> message. I
[quoted text clipped - 68 lines]
>> >> > Thank you,
>> >> > Silvio
paddyIE - 31 Dec 2006 21:28 GMT
Silvio,
" I ahve no idea what you talking about sorry. My access programming
experience is limited. "
This might help, ".... list of the references that you must set when you use
Microsoft Office Access 2003 ...."
http://support.microsoft.com/kb/825796/

Signature
Patrick
> Even using commandbar instead of commandbars I am getting the same message. I
> am using Access 2003. How do I add a reference to the appropriate Office
[quoted text clipped - 63 lines]
> > >> > Thank you,
> > >> > Silvio