Startup Options/Database Password

G

Guest

Hello,

I have a database with certain startup options for the end user. What I
would like is for the database to prompt for a password ONLY IF the shift key
is used to try and bypass the startup options, so that only an authorized
person with the password can see the background of the database. If I simply
set a database password from the Tools menu, it asks for that password with
the startup options as well, and I actually locked myself out of a database
that way! So there needs to be some kind of check for whether or not the user
attempted to bypass the startup options, and based on that, ask for a
password or not. I am not sure if I can do this through Access options
directly, or I will require some coding, but either method is fine.

Please help!

Thank you,
Kriti
 
R

Rick Brandt

kriti said:
Hello,

I have a database with certain startup options for the end user. What
I would like is for the database to prompt for a password ONLY IF the
shift key is used to try and bypass the startup options, so that only
an authorized person with the password can see the background of the
database. If I simply set a database password from the Tools menu, it
asks for that password with the startup options as well, and I
actually locked myself out of a database that way! So there needs to
be some kind of check for whether or not the user attempted to bypass
the startup options, and based on that, ask for a password or not. I
am not sure if I can do this through Access options directly, or I
will require some coding, but either method is fine.

Please help!

Thank you,
Kriti

Can't be done. Holding shift prevents any startup code or macros from running
and you would need one of those to prompt for the password.

You can disable the shift key entirely and have a secret way to run code to
re-enable it fo admin users.
 
G

Guest

How about if I approach this in the opposite way? Set a database password,
but if shift is NOT pressed, programatically either PROVIDE the program with
the password so the end-user does not see it, or else disable the password
requirement. Can something along these lines be implemented?
 
R

Rick Brandt

kriti said:
How about if I approach this in the opposite way? Set a database
password, but if shift is NOT pressed, programatically either PROVIDE
the program with the password so the end-user does not see it, or
else disable the password requirement. Can something along these
lines be implemented?

I really don't recommend bothering. The reality of the situation is if your
users aren't familiar with Access you can do just about anything to keep them
out of areas you don't want them in and if they are familiar with it there is
almost nothing you can do to keep them out.

Most people hide the interface, disable the shift key, split the app, and then
give users an MDE copy of the front end which locks them out of most design
areas. Developers then have access to the master MDB copy where design changes
can be made.

Trying to get the best of both worlds from one copy of the file is a BAD idea in
a multitude of ways. Just don't do it.
 
G

Guest

Well the users are definitely familiar enough to know the Shift approach, but
they won't be TRYING to hack in, since I'm developing the system for someone
in the company. However, I want a basic level of blockage to prevent any
accidental ways the user(s) might land up into the background where they
might mess with tables. Just one developer should have access to the
tables/queries/forms in design view/VBA code. There is no straightforward way
of doing this? Other than disabling/enabling the shift bypass key each time?
 
R

Rick Brandt

kriti said:
Well the users are definitely familiar enough to know the Shift
approach, but they won't be TRYING to hack in, since I'm developing
the system for someone in the company. However, I want a basic level
of blockage to prevent any accidental ways the user(s) might land up
into the background where they might mess with tables. Just one
developer should have access to the tables/queries/forms in design
view/VBA code. There is no straightforward way of doing this? Other
than disabling/enabling the shift bypass key each time?

User Level Security. Can be hacked but the person must at least be willing to
spend some money.
 
G

Guest

Yeah no one would try that hard to break into it! If they try at all.

How would I implement user level security?
 
R

Rick Brandt

kriti said:
Yeah no one would try that hard to break into it! If they try at all.

How would I implement user level security?

ULS is an advanced topic and nearly everyone gets it wrong on the first few
tries. There is a dedicated newsgroup to the topic, Microsoft has an FAQ
document on it, and more than one MVP has web sites with very specific step by
step instructions to follow. Google for posts from Joan Wild. She has one such
list and following one of those is your best bet.
 
W

Warren

Hi Kriti,

The code below is crude but I'm sure you can alter it to your needs.

It works for me; I have a 'secret' box the size of a cornflake that I
click. I enter my password, select my 'unlock' option and then exit the
DB and re-enter holding the shift key. When I'm done, I click my box,
enter my password, select my 'lock' option then exit the DB. On
re-entry, the shift key is disabled!

It's simple and it works for me! Enjoy!


Private Sub MyBox_Click()
Dim Pass As String
Dim db As Database
Dim prp As Property

Pass = InputBox("Password:", "Password")
If Pass = "YOUR PASSWORD" Then
Dim Response
Response = MsgBox("Lock = 'YES'" & vbCrLf & "Unlock = 'NO'",
vbYesNo, "Unlock")
If Response = vbYes Then
'This Code Disables the Shift Key
Set db = CurrentDb
Set prp = db.CreateProperty("AllowByPassKey", dbBoolean,
False)
db.Properties.Append prp

Else
'This Code Enables the Shift Key
Set db = CurrentDb
db.Properties.Delete "AllowByPassKey"
db.Properties.Refresh
End If
Else
End If
Set db = Nothing
Set prp = Nothing
End Sub
 
G

Guest

Here is a possible answer for you:
create a macro called "AutoExec" with a runcode command set to a function
designed for a startup routine. I will call the startup function Start().
in Start() I would:

1. check to see if the allowbypass property is set and if not set it then
quit.

2. check, using an api, if the shift key is pressed if true then show
database window. if false then hide database window and show you first user
window.
 

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