OK several things before I give the solution:
1. As you have a login form you should have provided the user name / password combination required
2. You INCLUDED tblEmployees! I renamed it to trigger the error
3. You should add Option Explicit at the top of EVERY module to ensure compile errors don't slip through.
To set this by default, tick Require Variable Declaration in the VBE Editor Options dialog box
The database you supplied won't compile because of errors - you need to identify & fix these one by one
4. Why is your sample database so large?
I decompiled & compacted it - no change. You have no attachment fields (good!). Lots of forms but even so ....
5. Strongly recommend you name controls something meaningful - Command0 isn't helpful
6. Also recommend you use error handling in your procedures
Anyway, the solution for your issue is error handling.
I added it & identified the error as 3078 so I then applied a rule for that error
In this case, to show a message & quit the app ... modify as you wish
Code:
Private Sub Command0_Click()
On Error GoTo Err_Handler
If IsNull(txtUsername) Then
MsgBox "Invalid username"
Exit Sub
End If
If IsNull(txtPassword) Then
MsgBox "Invalid Password"
Exit Sub
End If
Dim X As Long
X = Nz(DLookup("EmployeesID", "qryEmployeesCurrent", "Username='" & txtUsername & "' AND Password='" & txtPassword & "'"))
If X > 0 Then
' We have a valid user
DoCmd.OpenForm "frmMainMenu"
Forms!frmMainMenu!txtUserID = X
Forms!frmMainMenu!txtUsername = txtUsername
DoCmd.Close acForm, "frmLogin"
Else
MsgBox "invalid Login"
End If
Exit_Handler:
Exit Sub
Err_Handler:
If Err = 3078 Then
MsgBox "The network connection is currently not available." & vbCrLf & _
"Please try again later ..." & vbCrLf & vbCrLf & _
"This application will now close", vbExclamation, "Network error"
Application.Quit
Else
MsgBox "Error " & Err.Number & " in frmLogin Command0_Click procedure: " & Err.Description, vbCritical, "Program Error"
GoTo Exit_Handler
End If
End Sub
Modified version attached with this code