Password Protected Command Button/Form ?

G

Guest

Hi,

I know it is possible to password protect an entire database however is it
possible to apply password protection on individual command buttons on a
switchboard. I have one form I wish to restrict access to.

Thanks,
David
 
G

Guest

Try this it works on mine for a button. In the event/on click put this code in.

Private Sub The name of your button_Click()

Dim strPasswd

strPasswd = InputBox("Please Enter Password", "Restricted Form")

'See if a valid entry made to input box

If strPasswd = "" Or strPasswd = Empty Then
MsgBox "No Input Provided", vbInformation, "Required Data"
Exit Sub
End If

'correct password is entered open Main form Close, Opening Sheet

If strPasswd = "enter your password here" Then
DoCmd.OpenForm "Enter your form name you want open here", acNormal
Else
MsgBox "Sorry, you do not have access to this form", vbOKOnly, "Important
Information"
Exit Sub
End If
End Sub
 

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