Hello,
I'm trying to figure out how I might modify the code I have so that admins only have to enter the password once per session instead of every time the button is clicked.
This is what I have:
I'm assuming this would be done by setting a tempvar, but I'm not 100% sure how to go about that while still providing the input box if that variable isn't set.
I'm trying to figure out how I might modify the code I have so that admins only have to enter the password once per session instead of every time the button is clicked.
This is what I have:
Code:
Private Sub Adminbtn_Click()
Dim strPasswd
strPasswd = InputBox("Enter Password", "Restricted Form")
If strPasswd = "" Or strPasswd = Empty Then
MsgBox "No Input Provided", vbInformation, "Required Data"
Exit Sub
End If
If strPasswd = DLookup("[Admin Pass]", "[Password]") Then
DoCmd.OpenForm "Admin Panel", acNormal
Else
MsgBox "Sorry, you do not have access to this form", _
vbOKOnly, "Important Information"
Exit Sub
End If
End Sub
I'm assuming this would be done by setting a tempvar, but I'm not 100% sure how to go about that while still providing the input box if that variable isn't set.