Password on Forms

  • Thread starter Thread starter Rob
  • Start date Start date
R

Rob

I want users not to be able to open some of the forms
without a password. They would attempt to open the forms
by command button. Is there anyway to restrict opening a
form without a password? Any suggestions would be greatly
appreciated.
 
-----Original Message-----
I want users not to be able to open some of the forms
without a password. They would attempt to open the forms
by command button. Is there anyway to restrict opening a
form without a password? Any suggestions would be greatly
appreciated.


.

You might be better off using Access permissions for
something like that; sound like a lot of hard work to me !

Failing that, the Form_Open Event has a Cancel argument,
so you could place your code there, and set Cancel to True
if they don't enter the correct one. Something like this

Private Sub Form_Open(Cancel As Integer)

Const cstrPassword = "password"

If InputBox("Enter password:") <> cstrPassword Then
MsgBox "Wrong password!", vbExclamation
Cancel = True
End If

End Sub


Hope that helps. Let me know how you get on.


Damien
 
Back
Top