473,702 Members | 2,819 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.ShowToolb ar "Database", acToolbarNo
DoCmd.ShowToolb ar "Relationships" , acToolbarNo
DoCmd.ShowToolb ar "Table Design", acToolbarNo
DoCmd.ShowToolb ar "Table Datasheet", acToolbarNo
DoCmd.ShowToolb ar "Query Design", acToolbarNo
DoCmd.ShowToolb ar "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 5448
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.ShowToolb ar "Database", acToolbarNo
DoCmd.ShowToolb ar "Relationships" , acToolbarNo
DoCmd.ShowToolb ar "Table Design", acToolbarNo
DoCmd.ShowToolb ar "Table Datasheet", acToolbarNo
DoCmd.ShowToolb ar "Query Design", acToolbarNo
DoCmd.ShowToolb ar "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.ShowToolb ar 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.Cou nt
If CommandBars(int looper).Name <> "Menu bar" Then
DoCmd.ShowToolb ar strToolbar, acToolbarNo 'hide it
Debug.Print "Hiding " & _
CommandBars(int looper).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.ShowToolb ar "Form View", acToolbarNo
DoCmd.ShowToolb ar "Task Pane", acToolbarNo
DoCmd.ShowToolb ar "Database", acToolbarNo
DoCmd.ShowToolb ar "Menu Bar", acToolbarNo
DoCmd.ShowToolb ar "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)
----------
"Perseveran ce - 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.ShowToolb ar 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.ShowToolb ar 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
6435
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: onLoad="javascript:moveTo(((screen.availWidth*.5)-500),((screen.availHeight*.5)-300)); window.resizeTo(1000,550); ">
19
13041
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 and no cross-browsers solutions and all of that we know, but they have told me they have seen that before and how then the annoying pop-up windows work? . . .
4
8575
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 menus/toolbars over.
1
2646
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 automatically find and convert their Access97 databases on a specific drive. I want to convert the databases through VBA : 1. create an empty Access2000 2. set the right properties and references 3. import the objects (tables, queries,...
1
1799
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 the administrator should be able to see the full menus, plus toolbars. The shift-bypass key is disabled; too many people know about it. If I allow toolbars at startup, I can't seem to set the visible property of either the "Form View" or...
1
11315
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 Allow Toolbar/Menu Changes Use Access Special Keys
4
1655
by: MLH | last post by:
Is there a simple way to hide built-in toolbars in A97?
1
1473
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
1926
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 the MDB, renamed the toolbar, and then imported it back into the original MDB as a copy of the original (see "Copying a custom menu bar" thread here). Everything seemed fine until I tried to modify the copy. When I added or removed items from the...
0
9234
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8983
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8940
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7831
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6575
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4412
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3107
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2402
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2036
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.