Creating a password Form

  • Thread starter Thread starter Loretta Sharp
  • Start date Start date
L

Loretta Sharp

I would like to create a form with a text box that will
have to contain the correct password before clicking on a
command button that will take you to the next form
 
In the OnClick Of your command Button

If me.txtPassword <> strMyPassword then
MsgBox "Go Away. I don't want to play with you"
else
doCmd.OpenForm "frmMySecretStuff"
endif

You can use the special "Password" mask in the InputMask property of
your text box to hide your users input as it is typed


Be aware though, this very elementary security is very easy to bypass.

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)
 
Loretta,

Greg is right but you can increase security a little by storing a true value
in a global variable gblnPasswordOK and testing for this in the Form_Open
event of the form you will go to.

Private Sub Form_Open(Cancel as Integer)
If Not gblnPasswordOK then Cancel=True
End Sub

The form will not open unless the password has been entered correctly even
if the user tries to open the form from the database window.

Rod Scoullar
 
Back
Top