Jody Reid
asked on
How to put password on a button in Access 2013
I have a form that has 10 buttons to open other forms. How can i put a password protection on some of these buttons so only some people can access these forms. I am running access 2013 and windows 10.
Thank you.
Thank you.
yes, several ways of doing that.
What I like to do is get the "username" when the form loads and restrict the access only to certain users.
Add the below code to ON CLICK event procedure for one of our cmd buttons.
Dim user As String
user = Environ("username")
' msgbox user ' this could help you find out your username if you don't know it :)
If user <> "username1" And user <> "username2" And user <> "username3" And user <> "username4" Then
MsgBox "ACCESS DENIED - " & user
Else
DoCmd.OpenForm "FORM NAME", acNormal, "", "", , acNormal
End If
What I like to do is get the "username" when the form loads and restrict the access only to certain users.
Add the below code to ON CLICK event procedure for one of our cmd buttons.
Dim user As String
user = Environ("username")
' msgbox user ' this could help you find out your username if you don't know it :)
If user <> "username1" And user <> "username2" And user <> "username3" And user <> "username4" Then
MsgBox "ACCESS DENIED - " & user
Else
DoCmd.OpenForm "FORM NAME", acNormal, "", "", , acNormal
End If
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you.
and add Abort = (InputBox("Enter Password:") <> "p@$$w0rd")
Ideally the password should be encrypted and in a table so you can edit it at will, but with this maybe you get the idea