I have a large Access database that I have been programming for the past few months. Recently I made a small addition to the program, and suddenly my custom Employee Login screen no longer works. I know for a fact that it is this form in particular because I made the database load another form on startup, and the users could open it fine.
The code for the login screen is this:
Code:
Private Sub cmdLogin_Click()
If IsNull(cboLogin.Value) Or cboLogin.Value = "" Then
MsgBox "Please select a login username.", vbExclamation + vbOKOnly, _
"Lien On Me Title Services, Inc."
cboLogin.SetFocus
Exit Sub
End If
If IsNull(txtPassword.Value) Or txtPassword.Value = "" Then
MsgBox "Please enter a password.", vbExclamation + vbOKOnly, _
"Lien On Me Title Services, Inc."
txtPassword.SetFocus
Exit Sub
End If
If txtPassword.Value = DLookup("Password", "tblOfficeStaff", "[ID]=" & cboLogin.Value) Then
strUsername = DLookup("Firstname", "tblOfficeStaff", "[ID]=" & cboLogin.Value) & " " & _
DLookup("Lastname", "tblOfficeStaff", "[ID]=" & cboLogin.Value)
DoCmd.OpenForm "frmMain"
DoCmd.Close acForm, "frmLogin"
Else
MsgBox "Incorrect password!", vbCritical + vbOKOnly, _
"Lien On Me Title Services, Inc."
txtPassword.SetFocus
End If
End Sub
I think dlookup() is the culprit here, because it's the only code that does any work, and this form is the only place in the entire program that uses dlookup(). It says that it creates an error log, however, I can't seem to locate where it's at.
Any help would be greatly appreciated.