I have a table named tblEmployee with some fields: Password and Login.
For one record, the login field contains steveh and the password field contains 1111, both are short text field types.
Dialog Form with unbound Password and Login fields and an ok and cancel command button prodcues errors
I keep getting the error Run-time error '2471': The expression you entered as a query parameter produced this error: steveh
So it seems to me that the Dlookup statement is returning the login value instead of the password value.
This has got me stumped - I can't figure out what I am doing wrong:
For one record, the login field contains steveh and the password field contains 1111, both are short text field types.
Dialog Form with unbound Password and Login fields and an ok and cancel command button prodcues errors
I keep getting the error Run-time error '2471': The expression you entered as a query parameter produced this error: steveh
So it seems to me that the Dlookup statement is returning the login value instead of the password value.
This has got me stumped - I can't figure out what I am doing wrong:
Code:
Private Sub Command1_Click()
If IsNull(Me.txtLogin) Then
MsgBox "Please Enter Login", vbInformation, "Need ID"
Me.txtLogin.SetFocus
ElseIf IsNull(Me.txtPassword) Then
MsgBox "Please Enter Password", vbInformation, "Need Password"
Me.txtPassword.SetFocus
Else
If Nz(DLookup("[Password]", "tblEmployee", "[Login] =" & Me.txtLogin), "GarbageEntry") = Me.txtPassword Then
DoCmd.Close
MsgBox "Success"
'DoCmd.OpenForm "Master"
Else
MsgBox "Incorrect Login or Password"
End If
End If
End Sub