Passwords

G

Guest

i have a table that includes records of all employees & each person has a
password (field). i have a bunch of forms & have made a button called staff.
I want to make a form where, when you click on the staff button, a new form
will open up with a box & a button named enter included. This box will need
to have a password typed in before clicking on enter, Only the employee
passwords can be used to enter. Any other (Wrong) password, & the next form
will not be opened.

Please can anyone provide simple instructions on how to achieve this. thank
you
 
G

Guest

There is no simple way to do this. Also if you attempt to 'grow your own'
user level security, it will be easy for users to break it UNLESS you are an
excellent coder with outstanding knowledge of Access.

Therefore I suggest that you search Help for User-Level Security. The
built-in security tool can do what you want IF you follow the setup
procedures to the letter.

Oh. User-level security isn't in Access 2007 so don't go there.
 
G

germaine.oliver

The biggest difficulty I see in your scenario is how do you know who
the employee is? Will ANY password work? If you want the password
associated with that name, you're going to have to either have the
user type their user name, or pull it from the OS.

There are a couple of ways you can do this: you can use an inputbox,
then check to see if the inputbox matches the password field for the
employees. Or you can create a custom form, which allows a little more
flexibility. If you go with plan B, you want to create an unbound form
with a password text box (set the format to "password" to mask the
entry) and a command button "enter". On the "click" event of the
button, the code should look something like:

Sub cmdDone_Click ()
Dim sEntry
Dim r as dao.recordset
Dim UName
sEntry = me.cPassword
Uname = fosusername 'make sure you put the username function
somewhere in your project code, or have another text box on the form
the user can enter their username
set r = "Select * from tblPasswords WHERE Username = '" & uname & "'"
'
If r.eof then 'no password for this username
Msgbox "No password found for this user." 'direct them to the
mechanism for getting a password
docmd.close acform, "frmPasswordHolder"
End if
End if
If r!Password = sEntry then
Docmd.openform "frmName"
docmd.close acform, "frmPasswordHolder"
Else MSgbox "Bad password entered." & vbcr & "Please re-enter."
docmd.gotocontrol "cPassword"
End if
Set r = nothing
End sub


Hope that helps...
 

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

Similar Threads

Passwords on Access 2
Access 2000 DLookUp not functioning in a Form 1
Too many forms? 3
Access Login 3
OfficeMac4Update 4
Preview report for current record only?? 3
form difficulty 2
Change Password 4

Top