nika.duncan
Registered User.
- Local time
- Today, 02:17
- Joined
- Sep 23, 2013
- Messages
- 10
Hi All,
I have a login form that is linked to three other forms - Manager, Supervisors, Staff and Admin. I uses a table with Access Level 1-4 and base on whichever level it opens the form. The problem I am having is that the if I enter an incorrect password it still opens the correct form. the code I've use is not checking the password, not sure where to correct. Please if anyone can assist I have attached the code below. This will be greatly appreciated.
I have a login form that is linked to three other forms - Manager, Supervisors, Staff and Admin. I uses a table with Access Level 1-4 and base on whichever level it opens the form. The problem I am having is that the if I enter an incorrect password it still opens the correct form. the code I've use is not checking the password, not sure where to correct. Please if anyone can assist I have attached the code below. This will be greatly appreciated.
Code:
Private Sub txtPassword_AfterUpdate()
Me.txtAccessLevel = Me.cboLogin.Column(3)
Me.txtPassword = Me.cboLogin.Column(1)
'Check that a user has been selected
If IsNull(Me.cboLogin) Then
MsgBox "You need to select a user!", vbCritical
Me.cboLogin.SetFocus
Else
' Check for correct password
If Me.txtPassword = Me.cboLogin.Column(1) Then
'Check if password needs to be reset
' If Me.cboLogin.Column(2) = True Then
' DoCmd.OpenForm "frmPasswordChange", , , "[UserLoginID] = " & Me.cboLogin
' DoCmd.OpenForm "frmPasswordChange", , , "[UserID] = " & Me.cboUser
'Else
If Me.txtAccessLevel = 1 Then
DoCmd.OpenForm "frmAdminMode"
Me.Visible = False
Else
If Me.txtAccessLevel = 2 Then
DoCmd.OpenForm "frmManagers"
Me.Visible = False
Else
If Me.txtAccessLevel = 3 Then
DoCmd.OpenForm "frmSupervisors"
Me.Visible = False
Else
If Me.txtAccessLevel = 4 Then
DoCmd.OpenForm "frmStaff"
Me.Visible = False
Else
MsgBox "Password does not match, please re-enter!", vboOkOnly
Me.txtPassword = Null
Me.txtPassword.SetFocus
End If
End If
End If
End If
End If
End If
' End If
End Sub