I have written a module that can be called from a form on open event. It checks for a correct password. I want the code to set different permissions on the form as it opens.
The AllowAdditions line returns run time error
Public Sub RestrictedArea()
Dim strPasswd
strPasswd = InputBox("Enter Password", "This is a Restricted Area")
'Check to see if there is any entry made to input box, or if
'cancel button is pressed. If no entry is made then exit sub.
If strPasswd = "" Or strPasswd = Empty Then
MsgBox "You left the box blank, try again!", vbInformation, "Required Data"
DoCmd.Close
Exit Sub
End If
'If correct password is entered open
'If incorrect password entered give message and then exit sub
If strPasswd = "nam" Then
AllowAdditions = False
'AllowDeletions = False
'Continue to open Access Granted
Else
MsgBox "Sorry, you do not have access to this area", vbOKOnly, "Important Information"
DoCmd.Close
Exit Sub
End If
End Sub
The AllowAdditions line returns run time error
Public Sub RestrictedArea()
Dim strPasswd
strPasswd = InputBox("Enter Password", "This is a Restricted Area")
'Check to see if there is any entry made to input box, or if
'cancel button is pressed. If no entry is made then exit sub.
If strPasswd = "" Or strPasswd = Empty Then
MsgBox "You left the box blank, try again!", vbInformation, "Required Data"
DoCmd.Close
Exit Sub
End If
'If correct password is entered open
'If incorrect password entered give message and then exit sub
If strPasswd = "nam" Then
AllowAdditions = False
'AllowDeletions = False
'Continue to open Access Granted
Else
MsgBox "Sorry, you do not have access to this area", vbOKOnly, "Important Information"
DoCmd.Close
Exit Sub
End If
End Sub