Thanks Micron for the guidance. I made the change to the DLookup line. Error still there.
Code:
Private Sub cmdlogin_Click()
'Check to see if data is entered into the UserName textbox
If IsNull(Me.txtUsername) Or Me.txtUsername = "" Then
MsgBox "You must enter a User Name.", vbOKOnly, "Required Data"
Me.txtUsername.SetFocus
Exit Sub
End If
'Check to see if data is entered into the password textbox
If IsNull(Me.txtPassword) Or Me.txtPassword = "" Then
MsgBox "You must enter a Password.", vbOKOnly, "Required Data"
Me.txtPassword.SetFocus
Exit Sub
End If
'This section checks the value of password in tblEmployees to see if this matches value chosen in textbox on the form
If Me.txtPassword.Value = DLookup("Password", "tblUsers", "[UserID]= '" & Me.txtPassword & "'") Then
MyUserID = Me.txtUsername.Value
'Close logon form and open splash screen
'DoCmd.Close acForm, "frmLogon", acSaveNo
DoCmd.OpenForm "frmSplash_Screen"
Else
MsgBox "Password Invalid. Please Try Again", vbOKOnly, "Invalid Entry!"
Me.txtPassword.SetFocus
End If
'If User Enters incorrect password 3 times database will shutdown
intLogonAttempts = intLogonAttempts + 1
If intLogonAttempts > 3 Then
MsgBox "You do not have access to this database. Please contact your system administrator.", vbCritical, "Restricted Access!"
Application.Quit
End If
End Sub
Private Sub btnExit_Click()
On Error GoTo Err_btnExit_Click
Exit_btnExit_Click:
Me.Visible = False
Exit Sub
Err_btnExit_Click:
MsgBox Err.Description
Resume Exit_btnExit_Click
End Sub