Form password protection

  • Thread starter Thread starter paul
  • Start date Start date
P

paul

Hi,

I have just finished off a simple access database and
have placed it on the company network.

I have a password set to open the application, but I need
just one more password so that the administator people
can get access to administration form and keep the
regular users out.

It doesn't have to be that complicated, just enough to
deter people.
 
Yuu need to use user security, rather than a database password
Set up multiple users in "User and Group Accounts" off the security
menu. Its exact name and location varies with Access Versions, but its
not too hard to find

If you are not worrried about security, just want to make it easier
for people to do the right thing then 2 users will be enough

Admin (Built in user ) gets to see everything.
Assign a password to this account
NormalUser. No real need to set a password

The open the Admin form with some code that goes like

Function OpenAdminForm
If CurrentUser ="admin" then
DoCmdOpenForm "frmAdmin"
else
MsgBox "Ask Bob to do this for you"
endif
end Function

Place the code in a module, and call it instead of opening the form
directly

Note that this is not really secure (I would not do things this way
myself), but it will achieve what you asked with a minimum of fuss.
Any user will be able ot do anything if they bypass your menus.

another, possibly simpler option is to just keep two versions of the
database, one with the admin stuff, and one without.
You can link all the tables in one to the other
Then control things by distribution.

Regards Greg Kraushaar
Wentworth Falls Australia
(Do not email - the reply address is a Spam spoofer)
(If you really must, remove all UCase and numbers)
 
Maybe have the admin form ask for a password in its Form_Open event. Then,
if the user can not supply the password, the form can simply close itself.
Or do this in the main menu or switchbard form which has the button for the
admin form. When they cklick that button, ask for the password, & if they
can not provide it, simply do not call that form.

HTH,
TC
 
Greg, he says he wants to keep it simple. Implementing user-level security
would take him >weeks< to understand. (No adverse comment on him; that's
just how long it seems to take people - at an absolute minimum.)

TC
 
Sorry Greg, on reviewing your post, I see that you are not suggesting that
he does a full "bells & whistles" implementation of security. So your
suggestion is quite reasonable.

Cheers,
TC
 
One other option is to disable all the controls on the admin form
except one. If the correct password is typed into the control, then
unlock all the other controls.

Put the password into the Tag property so the following will work in
the AfterUpdate event

if me.PwdControl = me.tag then
on error resume next
for each ctl in me.controls
ctl.Enabled = true
next
else
msgBox "Ask Bob to do this"
me.PwdControl = ""
endif

again not terribly secure, but as TC says to do security properly
takes weeks to understand. Anything else won't stop more than the idle
curious.

Regards Greg Kraushaar
Wentworth Falls Australia
(Do not email - the reply address is a Spam spoofer)
(If you really must, remove all UCase and numbers)
 
Thnaks for all your help guys,

I like the idea of admins only being able to open the
form:

ie.
The open the Admin form with some code that goes like
Function OpenAdminForm
If CurrentUser ="admin" then
DoCmdOpenForm "frmAdmin"
else
MsgBox "Ask Bob to do this for you"
endif
end Function

Place the code in a module, and call it instead of opening the form
directly

I presume it be possible to have the admin be the only
person who can see the link from the switchboard to the
admin form?

someting like
If CurrentUser ="admin" then
adminbutton.visible = true

my apologies but just starting off with vba.

thanks again.
 
Back
Top