Password on Forms

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.
 
G

Guest

-----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
 

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

Top