Pauline123
Registered User.
- Local time
- Today, 03:29
- Joined
- Apr 1, 2013
- Messages
- 69
Hi all hope you can help - I have the following vba code but I keep getting the End If without Block If error message - cannot figure out what I have done wrong - can anyone help please
Private Sub txtPassword_AfterUpdate()
'Check that User is selected
If IsNull(Me.cboUser) Then
MsgBox "You need to select a user!", vbCritical
Me.cboUser.SetFocus
Else
'Check for correct password
If Me.txtPassword = Me.cboUser.Column(2) Then
'Check if password needs to be reset
If Me.cboUser.Column(4) Then
Select Case Nz(DLookup("Access", "tblUser", "AccessLevelID=" & Me.cboUser), "N/A")
Case "4"
DoCmd.OpenForm "UserSwitchboard"
Case "3"
DoCmd.OpenForm "AdminSwitchboard"
Case "2"
DoCmd.OpenForm "StoreManagerSwitchboard"
Case "1"
DoCmd.OpenForm "Main Switchboard"
End If
DoCmd.Close acForm, "frmLogin"
Else
MsgBox "Password does not match, please re-enter!", vboOkOnly
Me.txtPassword = Null
Me.txtPassword.SetFocus
End If
End If
End Sub
Private Sub txtPassword_AfterUpdate()
'Check that User is selected
If IsNull(Me.cboUser) Then
MsgBox "You need to select a user!", vbCritical
Me.cboUser.SetFocus
Else
'Check for correct password
If Me.txtPassword = Me.cboUser.Column(2) Then
'Check if password needs to be reset
If Me.cboUser.Column(4) Then
Select Case Nz(DLookup("Access", "tblUser", "AccessLevelID=" & Me.cboUser), "N/A")
Case "4"
DoCmd.OpenForm "UserSwitchboard"
Case "3"
DoCmd.OpenForm "AdminSwitchboard"
Case "2"
DoCmd.OpenForm "StoreManagerSwitchboard"
Case "1"
DoCmd.OpenForm "Main Switchboard"
End If
DoCmd.Close acForm, "frmLogin"
Else
MsgBox "Password does not match, please re-enter!", vboOkOnly
Me.txtPassword = Null
Me.txtPassword.SetFocus
End If
End If
End Sub