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

Show Menus/Toolbars on Startup

P: n/a
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
For admin users...
I would like to run some VB code in my Main startup form (OnOpen) to
show the default menu/toolbars as if the startup properties were not
set.
However I would like to leave the startup properties in tact, in case a

non-admin user logs in.
I use...
If Admin then
CommandBars("Database").Visibl*e = True ' Trying to show a menu
else 'non-admin
'non-admin code
end if
The issues are...
1. The CommandBar "Menu Bar" is displayed after the Main form is
visible, even with the startup properties set to turn off all
menus/toolbars. The menu seems limited and only related to forms and
records. The menu is definately not like the standard startup menu for
an Access database.
This seems to contradict what the startup properties suggest.
2. Using CommandBars("Database").Visibl*e = True in the OnOpen event
for
the case of admins does not show the toolbar or any other toolbar,
though I have not tried them all. I tried "Form View", "Formatting
(Form/Report)".
I do notice that the menus show up for a short duration along with the
normal default menus and then disappear after the Main form is visible.

It seems that the startup properties take effect after the Main form is

visible.
However, without restarting Access, if I restart the form (I enabled
the database window) the menus show up as coded.
But, the menus dont behave appropriately to the context of the window,
ie the "Form View" menu remains even if I click on the Database window.

Is there a way to bring up the default menu behavior for the admin case

without having to reset the startup properties and restarting?
TIA

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


P: n/a

<ce*******@yahoo.com> skrev i en meddelelse
news:11**********************@o13g2000cwo.googlegr oups.com...
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
For admin users...
I would like to run some VB code in my Main startup form (OnOpen) to
show the default menu/toolbars as if the startup properties were not
set.
However I would like to leave the startup properties in tact, in case a

non-admin user logs in.
I use...
If Admin then
CommandBars("Database").Visibl*e = True ' Trying to show a menu
else 'non-admin
'non-admin code
end if
The issues are...
1. The CommandBar "Menu Bar" is displayed after the Main form is
visible, even with the startup properties set to turn off all
menus/toolbars. The menu seems limited and only related to forms and
records. The menu is definately not like the standard startup menu for
an Access database.
This seems to contradict what the startup properties suggest.
2. Using CommandBars("Database").Visibl*e = True in the OnOpen event
for
the case of admins does not show the toolbar or any other toolbar,
though I have not tried them all. I tried "Form View", "Formatting
(Form/Report)".
I do notice that the menus show up for a short duration along with the
normal default menus and then disappear after the Main form is visible.

It seems that the startup properties take effect after the Main form is

visible.
However, without restarting Access, if I restart the form (I enabled
the database window) the menus show up as coded.
But, the menus dont behave appropriately to the context of the window,
ie the "Form View" menu remains even if I click on the Database window.

Is there a way to bring up the default menu behavior for the admin case

without having to reset the startup properties and restarting?
TIA

I use the below mentioned code.
Maybe that can help you.
I set a boolean value in the Administrator screen.
The name is "tillad_menuer".

Sub SetStartupProperties()
Const DB_Text As Long = 10
Const DB_Boolean As Long = 1
tillad_menuer = DLookup("[Vis_menuer]", "parametre")
If tillad_menuer <> -1 Then
'ChangeProperty "StartupForm", , "Startform"
ChangeProperty "StartupShowDBWindow", DB_Boolean, False
ChangeProperty "StartupShowStatusBar", DB_Boolean, False
ChangeProperty "AllowBuiltinToolbars", DB_Boolean, False
ChangeProperty "AllowFullMenus", DB_Boolean, False
ChangeProperty "AllowBreakIntoCode", DB_Boolean, False
ChangeProperty "AllowSpecialKeys", DB_Boolean, False
ChangeProperty "AllowBypassKey", DB_Boolean, False
Else
'ChangeProperty "StartupForm", , "Startform"
ChangeProperty "StartupShowDBWindow", DB_Boolean, True
ChangeProperty "StartupShowStatusBar", DB_Boolean, True
ChangeProperty "AllowBuiltinToolbars", DB_Boolean, True
ChangeProperty "AllowFullMenus", DB_Boolean, True
ChangeProperty "AllowBreakIntoCode", DB_Boolean, True
ChangeProperty "AllowSpecialKeys", DB_Boolean, True
ChangeProperty "AllowBypassKey", DB_Boolean, True
End If

End Sub

Function ChangeProperty(strPropName As String, varPropType As Variant,
varPropValue As Variant) As Integer
Dim dbs As Object, prp As Variant
Const conPropNotFoundError = 3270

Set dbs = CurrentDb
On Error GoTo Change_Err
dbs.Properties(strPropName) = varPropValue
ChangeProperty = True

Change_Bye:
Exit Function

Change_Err:
If Err = conPropNotFoundError Then ' Property not found.
Set prp = dbs.CreateProperty(strPropName, _
varPropType, varPropValue)
dbs.Properties.Append prp
Resume Next
Else
' Unknown error.
ChangeProperty = False
Resume Change_Bye
End If
End Function

Private Sub Form_Activate()
DoCmd.Maximize
Call SetStartupProperties
Kode = ""
End Sub
Nov 13 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.