By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,656 Members | 801 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,656 IT Pros & Developers. It's quick & easy.

Restore Menus and Toolbars

P: n/a
The only reason I ask is that no one has made this subject clear or
given a definitive answer.

What I would like to do is, after turning off all the menus/tbars/etc
using the startup options.

Upon restarting Access, when an admin is detected (I use a
GetSystemUser() function) I want to restore everything so that Access
behaves like normal, ie. all menus/tbars/etc show up (only where they
are supposed to show up).

This line shows the db window, from which I get to the code, design,
etc, however no menus or toolbars...

DoCmd.SelectObject acTable, , True

This is the only way an Admin can get control over the database.
Doable, but VERY inconvenient.
Just to be clear....
I'm not interested in adjusting any "ChangeProperty" because that is
only good after a restart of Access. (Unless, of course, you recommend
it) I want the changes now, during the admin session.

I'm not interested in adjusting any menu or toolbar on a 'micro'
level. I want the whole menu or toolbar to behave normally. I haven't
done anything to the standard menus or toolbars, except 'hide' them
with the startup options. So I dont see a need to adjust each menu/tbar
item.

I thought something like the following would do it, but it doesn't...
DoCmd.ShowToolbar "Menu Bar", acToolbarWhereApprop

The following did not restore anything...
Dim i As Integer
For i = 1 To CommandBars.Count
CommandBars.Item(i).Enabled = True
Next i

The following showed all menus, which crowded the whole screen...
Dim i As Integer
For i = 1 To CommandBars.Count
CommandBars.Item(i).Enabled = True
CommandBars.Item(i).Visible = True
Next i

And this is so unpredictable it contradicts what "Help" implies...
CommandBars.Item(i).Reset

Quote from Access Help...(under "CommandBar.Reset")
"Resetting a built-in control restores the actions originally intended
for the control and resets each of the control's properties back to its
original state. Resetting a built-in command bar removes custom
controls and restores built-in controls."

So, the question is, Is there a way to reset all the menus/tbars/etc
back to normal, in VBA code, depending on the user detected?

Any advice would be appreciated.
I cant seem to get a grip on what's going on and what seems to be a
reasonable way to restore the menus is not working.

TIA
Christopher

Nov 13 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
The following code will give you an example:

For intI = 1 To CommandBars.Count
DoCmd.ShowToolbar CommandBars(intI).Name, acToolbarWhereApprop
Next intI

From testing this in Access 2003, I have found the following:

Numbers 1, 2, and 175-179 in the list of toolbars below will cause Access to
crash, so you will need to test for them and skip them in the loop. You
would have to set them back to your desired option if the user isn't an
Admin. I have also seen this list change. However, this won't change the
option in Startup. The Startup option will still override this. To change
the startup option you will need to set the Property, as you have mentioned.
To keep from needing to reopen the database, the easiest way around this may
be to just hold down the Shift key as you open the database. This will cause
the Startup options to be bypassed.

1 Task Pane
2
3 Database
4 Menu Bar
5 Formatting (Datasheet)
6 Filter/Sort
7 Query Datasheet
8 Table Datasheet
9 Table Design
10 Report Design
11 Print Preview
12 Form Design
13 Query Design
14 Toolbox
15 Formatting (Form/Report)
16 Form View
17 Source Code Control
18 Relationship
19 Macro Design
20 Utility 1
21 Utility 2
22 Web
23 Page Design
24 Formatting (Page)
25 View Design
26 Diagram Design
27 Stored Procedure Design
28 Trigger Design
29 Alignment and Sizing
30 Page View
31 PivotTable
32 PivotChart
33 Formatting (PivotTable/PivotChart)
34 Function Design
35 Data Outline
36 Field List
37 Shortcut Menus
38 Font/Fore Color
39 Fill/Back Color
40 Line/Border Style
41 Line/Border Width
42 Line/Border Color
43 Special Effect
44 Fill/Back Color
45 Font/Fore Color
46 Line/Border Color
47 Datasheet Special Effect
48 Gridlines
49 Appearance
50 Database TitleBar
51 Table DesignTitleBar
52 Table Design Upper Pane
53 Table Design Lower Pane
54 Table Design Properties
55 Index TitleBar
56 Index Upper Pane
57 Index Lower Pane
58 Index Properties
59 Actions
60 Relationship TableFieldList
61 Relationship QueryFieldList
62 Relationship Join
63 Table Design Datasheet
64 Table Design Datasheet Column
65 Table Design Datasheet Row
66 Table Design Datasheet Cell
67 Query
68 Query DesignFieldList
69 Query Design Join
70 Query DesignGrid
71 Query SQLTitleBar
72 Query SQLText
73 Query Design Properties
74 Query Design Datasheet
75 Query Design Datasheet Column
76 Query Design Datasheet Row
77 Query Design Datasheet Cell
78 Filter General Context Menu
79 Filter Field
80 Filter FilterByForm
81 Form DesignTitleBar
82 Form Design Form
83 Form Design Section
84 Form Design Control
85 Form Design Control OLE
86 Report DesignTitleBar
87 Report DesignReport
88 Report Design Section
89 Report Design Control
90 Form/Report Properties
91 Form View Popup
92 Form View Subform
93 Form View Control
94 Form View Subform Control
95 Form View Record
96 Form Datasheet
97 Form Datasheet Column
98 Form Datasheet Subcolumn
99 Form Datasheet Row
100 Form Datasheet Cell
101 Print Preview Popup
102 Macro TitleBar
103 Macro UpperPane
104 Macro Condition
105 Macro Argument
106 ModuleUncompiled
107 ModuleCompiled
108 Module Immediate
109 Module Watch
110 Database Table/Query
111 Database Form
112 Database Report
113 Database Macro
114 Database Module
115 Database Page Popup
116 Database Background
117 OLE Shared
118 Global
119 Object Browser
120 Module LocalsPane
121 Tab Control
122 Tab Control on Report Design
123 Page Popup
124 View Table Design Popup
125 View Design Background Popup
126 View Design Diagram Pane Popup
127 View Design Field Popup
128 View Design Grid Pane Popup
129 View Design SQL Pane Popup
130 Diagram Design Popup
131 Diagram Popup
132 View Design Multiple Select Popup
133 View Design Join Line Popup
134 View Table View Mode Submenu
135 View Show Panes Submenu
136 Web Page Layout
137 Join Line Popup
138 Stored Procedure Design Datasheet
139 View Design Datasheet
140 Diagram Design Label Popup
141 Stored Procedure Design Popup
142 Trigger Design Popup
143 Database Shortcut Popup
144 Database Custom Group Popup
145 Database View
146 Database Stored Procedure
147 Database Diagram
148 Group Level Properties
149 Table PivotTable Popup
150 Table PivotChart Popup
151 Query PivotTable Popup
152 Query PivotChart Popup
153 Form PivotTable Popup
154 Form PivotChart Popup
155 Stored Procedure PivotTable Popup
156 Stored Procedure PivotChart Popup
157 View PivotTable Popup
158 View PivotChart Popup
159 Page Selection Popup
160 Document Selection Popup
161 Control Selection Popup
162 Expando Selection Popup
163 Section Selection Popup
164 Navigation Control Popup
165 PivotList Popup
166 Function Design
167 PivotTable Popup
168 PivotChart Popup
169 Function Datasheet Popup
170 Function Pivot Table Popup
171 Function Pivot Chart Popup
172 Connection
173 Add to Page
174 Field Node
175 Relationship
176 Clipboard
177 Envelope
178 System
179 Online Meeting

--
Wayne Morgan
MS Access MVP
<ce*******@yahoo.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...
The only reason I ask is that no one has made this subject clear or
given a definitive answer.

What I would like to do is, after turning off all the menus/tbars/etc
using the startup options.

Upon restarting Access, when an admin is detected (I use a
GetSystemUser() function) I want to restore everything so that Access
behaves like normal, ie. all menus/tbars/etc show up (only where they
are supposed to show up).

This line shows the db window, from which I get to the code, design,
etc, however no menus or toolbars...

DoCmd.SelectObject acTable, , True

This is the only way an Admin can get control over the database.
Doable, but VERY inconvenient.
Just to be clear....
I'm not interested in adjusting any "ChangeProperty" because that is
only good after a restart of Access. (Unless, of course, you recommend
it) I want the changes now, during the admin session.

I'm not interested in adjusting any menu or toolbar on a 'micro'
level. I want the whole menu or toolbar to behave normally. I haven't
done anything to the standard menus or toolbars, except 'hide' them
with the startup options. So I dont see a need to adjust each menu/tbar
item.

I thought something like the following would do it, but it doesn't...
DoCmd.ShowToolbar "Menu Bar", acToolbarWhereApprop

The following did not restore anything...
Dim i As Integer
For i = 1 To CommandBars.Count
CommandBars.Item(i).Enabled = True
Next i

The following showed all menus, which crowded the whole screen...
Dim i As Integer
For i = 1 To CommandBars.Count
CommandBars.Item(i).Enabled = True
CommandBars.Item(i).Visible = True
Next i

And this is so unpredictable it contradicts what "Help" implies...
CommandBars.Item(i).Reset

Quote from Access Help...(under "CommandBar.Reset")
"Resetting a built-in control restores the actions originally intended
for the control and resets each of the control's properties back to its
original state. Resetting a built-in command bar removes custom
controls and restores built-in controls."

So, the question is, Is there a way to reset all the menus/tbars/etc
back to normal, in VBA code, depending on the user detected?

Any advice would be appreciated.
I cant seem to get a grip on what's going on and what seems to be a
reasonable way to restore the menus is not working.

TIA
Christopher

Nov 13 '05 #2

P: n/a
Thanks for the reply.

The problem is, full menus cant be restored on the fly without
restarting. (Unless you know otherwise)
Docmd.showtoolbar wont work, if Built-in menus is disabled.

So, I'm stuck with partial menus and if I use CommandBar.Item .visible,
the toolbar remains where ever I go in the database.

I just wanted to restore the normal Access behavior, from code, on
startup, without restarting, depending upon the current user.

You may confirm this, but it looks like I'll have to reconstruct all
the necessary menus/tbars for admins and show them appropriately. What
a PITA!

Any further comments are welcomed.

Nov 13 '05 #3

P: n/a
No, I don't know how to do it without a restart. As mentioned, the only
thing I can think of would be to hold down the Shift key as you open the
database the first time, thereby bypassing the Startup options.

--
Wayne Morgan
MS Access MVP
<ce*******@yahoo.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...
Thanks for the reply.

The problem is, full menus cant be restored on the fly without
restarting. (Unless you know otherwise)
Docmd.showtoolbar wont work, if Built-in menus is disabled.

So, I'm stuck with partial menus and if I use CommandBar.Item .visible,
the toolbar remains where ever I go in the database.

I just wanted to restore the normal Access behavior, from code, on
startup, without restarting, depending upon the current user.

You may confirm this, but it looks like I'll have to reconstruct all
the necessary menus/tbars for admins and show them appropriately. What
a PITA!

Any further comments are welcomed.

Nov 13 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.