I get the error message invalid Logon when i enter the correct password. What am i doing wrong? Here is my code: Private Sub Command5_Click()
If IsNull(UserName) Then MsgBox "Invalid username" Exit Sub End If If IsNull(Password) Then MsgBox "Invalid password" Exit Sub End If
Dim X As Long X = Nz(DLookup("UserID", "UserT", "Username='" & UserName & "' AND Password='" & Password & "'"))
If X > 0 Then 'We have a valid user MsgBox "VALID USER LOGON " & X DoCmd.Close acForm, "LoginF" Else MsgBox "Invalid Logon" End If
End Sub
Reply from Alex Hedley:
Try MsgBox Username and MsgBox Password to see they are correct. Try Debug.Print Nz(DLookup("UserID", "UserT", "Username='USER' AND Password='PASS'")) with your actual username and password copied from the UserT
Sorry, only students may add comments.
Click here for more
information on how you can set up an account.
If you are a Visitor, go ahead and post your reply as a
new comment, and we'll move it here for you
once it's approved. Be sure to use the same name and email address.