473,385 Members | 1,531 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

looping through toolbars

(RE: Access 2002 SP3)

There are many default toolbars that have the database window icon in
them. Different users will have various ones visible when my app
starts. When my app opens, I only want to display my custom toolbar in
my app and hide all others.

Here are some that some of my users have open...(my list keeps growing
here as I continue testing on different workstations:)

DoCmd.ShowToolbar "Database", acToolbarNo
DoCmd.ShowToolbar "Relationships", acToolbarNo
DoCmd.ShowToolbar "Table Design", acToolbarNo
DoCmd.ShowToolbar "Table Datasheet", acToolbarNo
DoCmd.ShowToolbar "Query Design", acToolbarNo
DoCmd.ShowToolbar "Query Datasheet", acToolbarNo

My list is growing as I said. So instead of listing them one by one,
is there a way via VBA to loop through *all* of the default toolbars,
check to see if that toolbar is visible and if it is , hide it?

Thanks.

Nov 13 '05 #1
4 5421
TechBoy wrote:
(RE: Access 2002 SP3)

There are many default toolbars that have the database window icon in
them. Different users will have various ones visible when my app
starts. When my app opens, I only want to display my custom toolbar in
my app and hide all others.

Here are some that some of my users have open...(my list keeps growing
here as I continue testing on different workstations:)

DoCmd.ShowToolbar "Database", acToolbarNo
DoCmd.ShowToolbar "Relationships", acToolbarNo
DoCmd.ShowToolbar "Table Design", acToolbarNo
DoCmd.ShowToolbar "Table Datasheet", acToolbarNo
DoCmd.ShowToolbar "Query Design", acToolbarNo
DoCmd.ShowToolbar "Query Datasheet", acToolbarNo

My list is growing as I said. So instead of listing them one by one,
is there a way via VBA to loop through *all* of the default toolbars,
check to see if that toolbar is visible and if it is , hide it?


I've had difficulty using the commandbars collection for anything but
explicitly naming the command bar I want to effect. For example to use
a do while loop or for each next.

But the proper way to do this is design the application with its own
menus and turn the default menus off in the startup dialog. It's simple
enough to do, but as with anything, a fair bit of work to decide what
you want your users to see and use.

--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "What's UP, Dittoooooo?" - Ditto
Nov 13 '05 #2
RLN

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 ***
Nov 13 '05 #3
RLN wrote:
Yes, it is bombing on this line:
--> DoCmd.ShowToolbar strToolbar, acToolbarNo


Yes, that makes sense from what I remember.

I just make sure tools->start up is set such that allow built in
toolbars and allow toolbar/menu changes are set to no. I may also
specify a start up menu bar, but mostly I specify menu and/or tool bars
at the form level.

If you do this, your users won't be able to fiddle with menus. You
probably know you can copy builtin menu items (such as print, find) by
holding the ctrl key and dragging the item to the new menu/tool bar. I
also found that the start up property "allow full menus", if not turned
on, prevents some built-in menus from displaying when you use them.
Print menus such as the zoom options is one such item, I think. How you
deal with this depends on your requirements.

--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "What's UP, Dittoooooo?" - Ditto
Nov 13 '05 #4
RLN wrote:
Yes, it is bombing on this line:
--> DoCmd.ShowToolbar strToolbar, acToolbarNo


Yes, that makes sense from what I remember.

I just make sure tools->start up is set such that allow built in
toolbars and allow toolbar/menu changes are set to no. I may also
specify a start up menu bar, but mostly I specify menu and/or tool bars
at the form level.

If you do this, your users won't be able to fiddle with menus. You
probably know you can copy builtin menu items (such as print, find) by
holding the ctrl key and dragging the item to the new menu/tool bar. I
also found that the start up property "allow full menus", if not turned
on, prevents some built-in menus from displaying when you use them.
Print menus such as the zoom options is one such item, I think. How you
deal with this depends on your requirements.

--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "What's UP, Dittoooooo?" - Ditto
Nov 13 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Steve Dorsey | last post by:
Hello I'm creating a web page that contains a flash presentation. I currently have it resizing the user's web page and placing it on the screen using this script: ...
19
by: Albretch | last post by:
Hi, client wants for a window with no toolbars to open (technical and 'esthetical' reasons) after the window, user clicks on, is being closed. I told them about security settings in browsers...
4
by: Karl Irvin | last post by:
In a 2000, can you transfer custom menus and toolbars to a new Access database. My mdf file is not compiling and I'm importing all data to a new database but don't see a way to get the...
1
by: Mario Crevits | last post by:
My name is Mario Crevits, I'm from Belgium (Roeselare) and I'm working with Access97 for several years now. We are in an Access97-2000 migration project. I'm writing a wizard for the end-users to...
1
by: MacDermott | last post by:
I have an MDB file which is secured using a custom MDW file. I'd like to have most users see only the shortened menu you see when you set the Startup option "Allow full menus" to False. But...
1
by: cefrancke | last post by:
I have set the Startup properties to the following... All menus, toolbars, etc are turned off plus these are unchecked Allow Full Menus Allow Built-in Toolbars Allow Default Shortcut Menus...
4
by: MLH | last post by:
Is there a simple way to hide built-in toolbars in A97?
1
by: Free BSD | last post by:
Hi, Is there a possibility that i can control the toolbars from my javascript code snippet ??? like ... make a window with my custom toolbars or like window.open .. with now toolbars
15
by: Neil | last post by:
So, I tried to copy a toolbar. I have a custom menu bar for a form. Tried to copy it so that I could modify the copy and use it with another form. With no direct way to copy it, I made a copy of...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.