MS Access Forum / Modules / DAO / VBA / May 2007
Using VBA to create start up options in Access
|
|
Thread rating:  |
ridders - 01 May 2007 23:36 GMT What is the VBA code needed to change startup options for a specified user? I have a database where all the startup options are disabled for all users except the administrator (CR).
I want to turn these on if the administrator is logged on. The following code will display the database window: If strCurrentUser = "CR" Then DoCmd.SelectObject acTable, , True End If
What code is needed for the other six startup options?
Alex Dybenko - 02 May 2007 07:13 GMT Hi, here how you can change startup options: http://www.mvps.org/access/general/gen0040.htm
but you can not change startup options on a fly, you have to reopen database in order to see the effect
 Signature Best regards, ___________ Alex Dybenko (MVP) http://alexdyb.blogspot.com http://www.PointLtd.com
> What is the VBA code needed to change startup options for a specified > user? [quoted text clipped - 8 lines] > > What code is needed for the other six startup options? ridders - 02 May 2007 19:40 GMT Sorry but I don't think this site answers my question. Perhaps I'm being dense!
The code i have is in a start up form. The user name is checked when the database opens so the start up conditions can be automatically checked against the user name There are 7 options in the startup dialog. I have all 7 switched off by default & want them on for the administrator only. The options are: 1. Display Database Window (code already done) 2. Display Status Bar 3. Allow Built-In Toolbars 4. Allow Toolbar/Menu Changes 5. Allow Full Menus 6. Allow Default Shortcut Menus 7. Use Access Special Keys
What code would switch each of 2->7 on? e.g. DoCmd.AllowFullMenus=True ...is no use What should it be? Should I use SetProperty? If so, how?
Thanks
> Hi, > here how you can change startup options: [quoted text clipped - 15 lines] > > > > What code is needed for the other six startup options? Alex Dybenko - 03 May 2007 09:31 GMT hi, I think all these properties in database object, if you run that code:
Dim prp As Property
For Each prp In db.Properties Debug.Print prp.Name Next prp
it will give you list of all, and what you are looking for are:
StartUpShowDBWindow StartUpShowStatusBar StartUpMenuBar AllowShortcutMenus AllowFullMenus AllowBuiltInToolbars AllowToolbarChanges AllowBreakIntoCode AllowSpecialKeys
so you can just use mentioned page code to set these properties
 Signature Best regards, ___________ Alex Dybenko (MVP) http://alexdyb.blogspot.com http://www.PointLtd.com
> Sorry but I don't think this site answers my question. Perhaps I'm being > dense! [quoted text clipped - 40 lines] >> > >> > What code is needed for the other six startup options? Scott McDaniel - 03 May 2007 13:26 GMT >Sorry but I don't think this site answers my question. Perhaps I'm being dense! The code at the link supplied by Alex will indeed allow you to change Startup options (the ChangeProperty function will either change the property, or create it with the value you specify), but as Alex said those options won't be in place until you close and re-open the database. You cannot, for example, set DisplayDatabaseWindow=True and have the db window show in the CURRENT session of your db ... however, the next time someone - anyone - starts the db, the database window will then show up.
If you want them to be turned on for the Admin, then the Admin would have to open the database, then close it, then reopen it ... or you could provide a separate interface for the Admin (assuming you've split the database, that is).
You can always build different toolbars for different Users/Groups, then turn them on/off based on user login ... this would give you a lot more control over the interface, and allow you to provde different functionality for different users. Still, you can't turn the Startup items on/off in the current session of your database ...
>> Hi, >> here how you can change startup options: >> http://www.mvps.org/access/general/gen0040.htm >> >> but you can not change startup options on a fly, you have to reopen database >> in order to see the effect Scott McDaniel scott@takemeout_infotrakker.com www.infotrakker.com
ridders - 08 May 2007 18:32 GMT Hi Alex / scott
Thanks for both of your replies. Haven't had time to try out what you suggest yet but I must contradict one thing you both stated. I have for some months used code "DisplayDatabaseWindow=True" for specified user only. See my original post. This code is attached to a hidden form used at startup It works fine without the user closing & reopening the database. Other users never see the database window!
So I'm wondering if i use the properties listed by Alex in this hidden form, will these also work 'on the fly'
> >Sorry but I don't think this site answers my question. Perhaps I'm being dense! > [quoted text clipped - 21 lines] > scott@takemeout_infotrakker.com > www.infotrakker.com Alex Dybenko - 08 May 2007 19:30 GMT Hi, I am not sure about DisplayDatabaseWindow, but some startup properties certainly requires application reload. Best if you could try and see what happening
 Signature Best regards, ___________ Alex Dybenko (MVP) http://alexdyb.blogspot.com http://www.PointLtd.com
> Hi Alex / scott > [quoted text clipped - 48 lines] >> scott@takemeout_infotrakker.com >> www.infotrakker.com ridders - 08 May 2007 20:43 GMT Alex
Now I really am being dense. Please can you explain where & how to use your original code idea: ------------------------------------ Dim prp As Property
For Each prp In db.Properties Debug.Print prp.Name Next prp
it will give you list of all, and what you are looking for are:
StartUpShowDBWindow StartUpShowStatusBar StartUpMenuBar AllowShortcutMenus AllowFullMenus AllowBuiltInToolbars AllowToolbarChanges AllowBreakIntoCode AllowSpecialKeys
-------------------------
Thanks
Alex Dybenko - 09 May 2007 08:33 GMT Hi, here you get properties names, now you can use code, provided via link, to set these properties, the same way like in link's example
 Signature Best regards, ___________ Alex Dybenko (MVP) http://alexdyb.blogspot.com http://www.PointLtd.com
> Alex > [quoted text clipped - 22 lines] > > Thanks ridders - 09 May 2007 19:49 GMT Alex
Sorry - I don't understand your reply:
> here you get properties names (where?) > now you can use code, provided via link, (What code / what link?) > to set these properties, the same way like in link's example (what example?) I've looked at both of your web addresses but I don't think these are relevant
Can you please assist me further
Alex Dybenko - 11 May 2007 04:42 GMT Hi, I meant this one: here how you can change startup options: http://www.mvps.org/access/general/gen0040.htm
 Signature Best regards, ___________ Alex Dybenko (MVP) http://alexdyb.blogspot.com http://www.PointLtd.com
> Alex > [quoted text clipped - 8 lines] > > Can you please assist me further Joseph R. Pottschmidt - 03 May 2007 01:52 GMT Hey Ridders:
What I would suggested that you do, is hide all that anyway and then create a MDE file of just the application parts (Queries, Forms, Reports, Macros, Modules), Having the Tables in a separate MDB file. This way you can have the option of having the customer menus when they are running the application, but once the application is open, the admin can open the database window simply by pressing F11.
Then he would be allowed to make changes, test them, and then distribute a new MDE file to all the users.
The other option is to make use of the CurrentUser() function that is available in MS Access. This will allow you to setup permissions for each table, Query, Form, Report, Macro, and module that you have in your MDB file.
Read up on how to implement a Database MDW file with your current MDE/MDB file. This way you can have some security with your app, if that is the reason that you want these options.
-----Original Message----- From: ridders [mailto:ridders@discussions.microsoft.com] Posted At: Tuesday, May 01, 2007 3:36 PM Posted To: microsoft.public.access.modulesdaovba Conversation: Using VBA to create start up options in Access Subject: Using VBA to create start up options in Access
What is the VBA code needed to change startup options for a specified user? I have a database where all the startup options are disabled for all users except the administrator (CR).
I want to turn these on if the administrator is logged on. The following code will display the database window: If strCurrentUser = "CR" Then DoCmd.SelectObject acTable, , True End If
What code is needed for the other six startup options?
|
|
|