A student posed a question: How to control access to forms after a user successfully logs into the system. The database that was designed is attached here.
TempVars("UserType") = rs!UserTypeID.Value captures the ID of the user logged in. (LOGIN FORM)
This code:
Private Sub Form_Load()
If Nz(DLookup("HasAccess", "tblUserAccess", "UserTypeID = " & TempVars("UserType") & " AND FormName = ' " & Me.Name & " ' "), False) = False Then
MsgBox "You do not have access"
DoCmd.Close acForm, Me.Name
End If
End Sub
is attached to the frmOrderApproval form.
unfortunately, all users are denied access to this form. help me to debug this code.