Hi all - I am unable to identify why my login screen allows Login and access to Main form after just typing in a correct employee name. It simply bypasses the need for the password to be added. Can anyone identify anything obvious that I am missing from the code below please.
Option Compare Database
Option Explicit
Private Sub btnLogin_Click()
Dim rs As Recordset
Set rs = CurrentDb.OpenRecordset("tblEmployee", dbOpenSnapshot, dbReadOnly)
rs.FindFirst "EmployeeName='" & Me.txtUserName & "'"
If rs.NoMatch = True Then
Me.lblwronguser.Visible = True
Me.txtUserName.SetFocus
Exit Sub
End If
Me.lblwronguser.Visible = False
If rs!Password <> Me.txtPassword Then
Me.lblWrongPass.Visible = True
Me.txtPassword.SetFocus
Exit Sub
End If
Me.lblWrongPass.Visible = False
DoCmd.OpenForm "FrmMain"
DoCmd.Close acForm, Me.Name
End Sub