Hi, i need some help with a DLookup for a couple columns.
I have a table names tblUsers with the following fields. User ID, Username, Password. I have a form that I need to code the click event for the OK button to check for a matching username and password. I have the following VBa for the Ok button, but it wont work past the first If condition.
Code:
Private Sub btnOk_Click()
If IsNull(usName) Or IsNull(curPW) Then
MsgBox "You must enter a Username and a Password." _
& vbCrLf & "Please try again.", vbCritical, _
"More information required."
Exit Sub
Else
If IsNull(DLookup("[User ID]", "tblUsers", "[Username]=" & Me.usName & " AND [Password]=" & Me.curPW)) Then
MsgBox "The criteria entered does not match any username and password on file." _
& vbCrLf & "Check your entries for Username and Password and try again.", vbExclamation, _
"Need to check criteria."
Exit Sub
End If
DoCmd.OpenForm "frmChangePasswordVerify", acViewPreview
DoCmd.Close acForm, "frmChangePassword"
Exit Sub
End If
End Sub
Any tips on how to get it to check the values entered into the text boxes on the form called, usName and curPw?