Open and Close Database Window based on User

G

Guest

Is there a way to open and close the database window using Visual Basic? My
database needs all outside users to not have access to anything but the form
displayed at startup. I have accomplished this by turning off all the
startup options and disabling the shift bypass key. I have also created a
custom toolbar for my use while upkeeping the database. I know that I can
use the "StartupShowDBWindow" in my code (which I have done), but if I do not
close the DB window before closing Access, the next time I open the file the
DB window is automatically displayed. So, if an admin does not close the DB
window before closing Access, another non-admin user can have access to the
DB window. I know that User-Level security may help solve this problem, but
I am not familiar with this and would prefer another method if available.
However, if User-Level security is the only answer, I am willing to do the
research and learn. Any help will be greatly appreciated!
 
N

Nick via AccessMonster.com

KatK,

I recently had the same problem - the way I solved it was on the startup
Form_Load, the first code I entered was :

'Selects the database window and hides it
DoCmd.SelectObject acTable, , True
DoCmd.RunCommand acCmdWindowHide

Which will hide the database from all users.
Then, when users login, if the program registers an Admin login then it runs:

DoCmd.SelectObject acTable, , True

,which will show the database window for the admin. Shortcut keys also
need to be turned off for it to be effective. It's a simple solution that
probably won't keep out anyone that is very determined, but I'm not working
in an environment where that is a concern.

HTH,
Nick
 
N

Nick via AccessMonster.com

Good point, I forgot to include the code that hid the menu bar.

The way I got around that one was to have

DoCmd.ShowToolbar "Menu Bar", acToolbarNo

where the database window is hidden. Then for the admin logon, I wrote

DoCmd.ShowToolbar "Menu Bar", acToolbarYes


- Nick
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top