Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: MS Access Password on a form  (Read 4225 times)

0 Members and 1 Guest are viewing this topic.

Norm

  • Guest
MS Access Password on a form
« on: February 21, 2005, 04:09:59 PM »
I would like to create a password on a form, but I cannot get the form
to close when the wrong password is entered. I have also tried
docmd.close.
Appreciate some help.

Private Sub Form_Current()
Dim Password, Pword
Password = "Swordfish"
Pword = InputBox("Type in your password")
If Pword <> Password Then
MsgBox "Sorry, incorrect password"
exit
End If

End Sub

gussery

  • Guest
Re: MS Access Password on a form
« Reply #1 on: February 24, 2005, 05:29:38 AM »
You really need to put the password routine on the procedure that opens the form.  Ask for the password before you open the form, not after.

Gary

Norm

  • Guest
Re: MS Access Password on a form
« Reply #2 on: February 24, 2005, 05:38:44 PM »
Thank you for your help.
Regards