How to password protect a form

  • Thread starter Thread starter MaryAnn
  • Start date Start date
M

MaryAnn

Im sorry, I have done some research on how to protect a form with a
password, I found some info. but I dont quite understand it (Im a new
user in MS Access). I was wondering if anybody can help me, I would
appreciate it :-)
First I would like to protect a form with a "User ID" and "Password"
using MS Access 2000.
I know that a table has to be created, with the fields "User ID" and
"Password"
Then a form needs to be created with the fields and a Login Button and
Close button, then on the login button the event procedure needs a
code.
I have found this code

Private Sub btnLogIn_Click()
Dim Password As Variant

Password = DLookup("Password", "Users", "UserID = '" & Me.txtUserID &
"' ")

If Nz(Password, "") = Me.txtPassword Then
DoCmd.Close
DoCmd.OpenForm "PasswordProtectedForm"
Else
MsgBox "Incorrect user ID or password"
End If

End Sub


The thing is that I dont know how to read this code, do I type what I
see?
Can anybody help me step by step on how to interpret this and how do I
put in the event procedure, do I erase what is alredy in the event
procedure? Maybe it would help if I told you my USER ID and PASSWORD-
User ID=MaryAnn Password=Keroppi1
Any help would be greatly appreciate it. Thank you and have a bless day
:-) -MaryAnn
 
Ignore that code, it is useless. It is very easy to break into an Access
application using that kind of security approach. You will be better served
to do some reading on Access security. It is not really simple, but neither
is it rocket science.
 
Back
Top