Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Know if user used the Shift key to bypass startup settings...

Status
Not open for further replies.

agc1976

Programmer
May 2, 2001
36
PR
Is it possible to know with code if the user used the Shift key to bypass the startup settings on my application?

I need (for security pursposes) some code to only be run if the application was started properly.

Any info you can provide is very helpful.

Thank you.

Alfred
 
Hi!

You can make a macro called autoexec, if you haven't already, and choose RunCode. There is a place to choose the name of a public function you have created. This macro runs when the database is opened normally and is bypassed when the shift key is used.

hth
Jeff Bridgham
 
Hi, thanks for the quick response...

That solution would still let the user run the code manually by double clicking on the macro. I don't want the code to be available if the user bypassed using the shift key... any ideas?

Thanks...
 
The code below will allow you to turn off the shift key work around... If you run the code with "false" instead of "True". If you want to re-enable the shift key work around just re-run the code with "false"

Function PreventBypass() As Boolean
'Dim prp As Property

'Set prp = CurrentDb.CreateProperty("AllowBypassKey", dbBoolean, True, True)
'CurrentDb.Properties.Append prp

'Set prp = Nothing
CurrentDb.Properties("AllowBypassKey") = false
End Function

' The only thing you have to modify is
'CurrentDb.Properties("AllowBypassKey") = false or true

Tyrone Lumley
augerinn@gte.net
 
Hi!

If you want to retain the option of using the shift key then you can right click on the autoexec macro and choose properties. In the properties window you can select hidden. That will keep the users from seeing the macro.

hth
Jeff Bridgham
 
Well, let me explain my situation as a whole...

I am using Access 97 and SQL Server.

Security is managed as follow:
1. Users are not granted any permissions to the SQL tables.
2. I have an Application Role on SQL with all the permissions for the tables
3. When the user enters the application, a code runs to give the user all the privileges of the "Application Role".
4. I use a custom made security system to allow users to enter to their corresponding screens.

Now here's my problem: If everything goes as expected (no bypass of shift key) I can have everything under control with VBA code. However, if the user bypassed the startup, he can then run the code that sets the "Application Role" and have access to all of the tables in the server.

Disabling the Shift Bypass would still leave me vulnerable to more advanced users/programmers who can find the code to re-enable the shift bypass. What I want is a way to tell if the user bypassed the startup and block him of executing the line of code which gives him access to all of the tables.

Hope you can understand the mess I just explained : )

Thanks again...

P.S. any other suggestions are welcome
 
Hi!

If security is that critical, and your users are that advanced in Access, then your only option is to totally lock down the Db. What Databaseguy gave you in his post is a good start but, with users like yours, you will need to go farther. In Tools/Startup you will need to unclick showing the database window(if for some reason you must let them use the database window, hide all of the objects they will not be allowed to use) basically uncheck every box, including the ones you find after hitting the advanced button. You will also need to make your own toolbar and menubar and set them as the defaults in the startup window and(I think) for your forms. All of this together will lock the Db tight enough that(after you disable the bypass key) you will not be able to get into it either, so, on your way out, you might as well make an .mde file out of the Db. Of course, you will need to make a copy for your own use so you have full access and can make changes if necessary, and they are always necessary. There are some good threads and FAQs which cover these topics as well.

hth
Jeff Bridgham
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top