where can I Find this code
Below is the code I am Using for my login though there is nothing that takes into account what
User role the user Has
Code:
Private Sub cmdLogin_Click()
On Error GoTo Err_ErrorHandler
'Check to see if data is entered into the UserName text box
If IsNull(Me.txtUserName) Or Me.txtUserName = "" Then
MsgBox "You must enter a User Name.", vbCritical, "Required Data"
Me.txtUserName.SetFocus
Exit Sub
End If
'Check to see if data is entered into the password box
If IsNull(Me.txtPassword) Or Me.txtPassword = "" Then
MsgBox "You must enter a Password.", vbCritical, "Required Data"
Me.txtPassword.SetFocus
Exit Sub
End If
'Check the values entered against the table data
If DCount("*", "tblUsers", "[UserName] = '" & Me.txtUserName & "' AND [UserPassword] = '" & Me.txtPassword & "'") = 0 Then
MsgBox "Either the UserName or Password are incorrect..." & vbCr & vbCr & "Press OK to try again", _
vbCritical, "Invalid Credentials"
Me.txtUserName = ""
Me.txtPassword = ""
Me.txtUserName.SetFocus
Else
DoCmd.OpenForm "frmButtons"
DoCmd.Close acForm, "frmLogon", acSaveNo
End If
exit_ErrorHandler:
Exit Sub
Err_ErrorHandler:
MsgBox Err.Description
Resume exit_ErrorHandler
End Sub
at the moment once the User has Logged on and is taken to the frm buttons
it doesnt matter who logged in.
Is there a way that the person logged in is remembered by the database so only the specific options for their particular User Role
Are Used or displayed?