Password Protected Command Button/Form ?

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
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
 
Back
Top