Hi,
I have this code for a login form. While execution, it throws Runtime Error 2185.
Can someone suggest, changes in the code:
Private Sub Command1_Click()
If IsNull(Me.txtLogin) Then
MsgBox "Please Enter Your CAO Code", vbInformation, "CAO Code Required"
Me.txtLogin.SetFocus
ElseIf
IsNull(Me.txtPassword) Then
MsgBox "Please Enter Password", vbInformation, "Password Required"
Me.txtPassword.SetFocus
Else
'Process the job
If (IsNull(DLookup("CAO_Code", "tbl_Login", "CAO_Code='" & Me.txtLogin.Value & "'"))) Or _
(IsNull(DLookup("Password", "tbl_Login", "Password='" & Me.txtPassword.Text & "'"))) Then
MsgBox "Incorrect CAO Code or Password"
Else 'MsgBox "CAO Code or Password Correct"
DoCmd.OpenForm "Form1"
End If
End If
End Sub