473,377 Members | 1,153 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,377 software developers and data experts.

CommandBars in Access 2002/2003

I'm trying to prevent any built-in command bars or menu bars from appearing
in an Access MDE.

I have the following code on the Form_Open event of the app's main form:

CommandBars("Menu Bar").Enabled = False

This works, but if a user has been using Access with a tool bar visible
(Form/Report
Formatting, for example) prior to opening my MDE, that tool bar is still
visible when my MDE is opened - despite not having a Menu Bar.

Can I just loop through the entire collection of command bars and disable
them all?

'Required reference Office 11.0 Object Library
Dim cb As CommandBar
For Each cb In CommandBars
cb.Enabled = False
Next

There are 177 named CommandBars in this loop, however. If I go to Tools >
Customize, I see only 28 Toolbars (on the Toolbars tab of the Customize
dialog).

Which toolbars can I safely disable? The only ones I really need to hide
are the ones that may still be visible after the app's main form is
maximized and the Menu Bar is disabled (since toolbars cannot be made
visible if there is no Menu Bar and the main form is maximized). The stuff
available on right click I can deal with elsewhere.

Other suggestions?

Thanks in advance.
Nov 13 '05 #1
1 3481
By trial and error, this list seems to be exhaustive.

Whatever other toolbars there are, they cannot be made visible once this
code is run.

Private Sub Form_Open(Cancel As Integer)
Dim varCb As Variant
'On Error Resume Next
For Each varCb In Array( _
"Task Pane", "Database", "Menu Bar", "Report Design", _
"Page View", "Alignment and Sizing", "Formatting (Page)", _
"Formatting (Datasheet)", "Print Preview", "Form Design", _
"Toolbox", "Form View", "Formatting (Form" & Chr(47) & "Report)", _
"Source Code Control", "Relationship", "Table Design", _
"Table Datasheet", "Query Design", "Filter/Sort", _
"Macro Design", "Utility 1", "Utility 2", "Page Design", _
"PivotTable", "PivotChart", "Query DataSheet", "Web", _
"Formatting (PivotTable" & Chr(47) & "PivotChart)")
CommandBars(varCb).Enabled = False
Next
End Sub

'Private Sub Form_Open(Cancel As Integer)
' Dim cb As CommandBar
' For Each cb In CommandBars
' cb.Enabled = True
' Debug.Print cb.Name
' Next
'End Sub

Nov 13 '05 #2

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

Similar topics

13
by: Noesis Strategy | last post by:
When I ordered my new laptop, Sony didn't offer Access 2003 in its bundles. Recently, I have begun to design Access databases using an copy of Access 2002 from my previous laptop. It works fine,...
1
by: Wayne Aprato | last post by:
I have a client who is running several Access 97 databases that I have written for them. They are about to upgrade to Access 2003. Is the default file format of Access 2003 still Access 2000 the...
3
by: Colin Chudyk | last post by:
Hi, Here is my situation. Can anyone provide insight? I have developed a database in Access 2002. I am planning to distribute it as a split MDE (front) / MDB (back) to be used by the Access...
7
by: Wayne Aprato | last post by:
I have several Access 2003 mde databases. When I try to open them in Access 2002 I get the following error: "The Visual Basic for Applications project in the database is corrupt." ...
6
by: Peter Frost | last post by:
Please help I don't know if this is possible but what I would really like to do is to use On Error Goto to capture the code that is being executed when an error occurs. Any help would be much...
28
by: Neil Ginsberg | last post by:
I have a client who is using Access 2002/2000 (the database itself is written in 2000), and is considering migrating to Access 2003. Any recommendations on whether Access 2003 is worth the migrate,...
47
by: ship | last post by:
Hi We need some advice: We are thinking of upgrading our Access database from Access 2000 to Access 2004. How stable is MS Office 2003? (particularly Access 2003). We are just a small...
52
by: Neil | last post by:
We are running an Access 2000 MDB with a SQL 7 back end. Our network guy is upgrading to Windows Server 2003 and wants to upgrade Office and SQL Server at the same time. We're moving to SQL Server...
3
by: banba_ca | last post by:
When I create a new db from the main Access window or thru Vb (set newdb = ...) I always end up with Access 2000 file format. I would like to get 2002 - 2003 file format. The reason is that when I...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
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: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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.