I am getting an Error 2001 here and I can't seem to find what the error is:
Here's the code:
Private Sub cmdLogin_Click()
Dim query As String
Dim login As String
Dim thepassword1 As String
Dim thepassword2 As String
Dim validLogin As String
Dim correctPassword1 As String
Dim correctPassword2 As String
txtLogin.SetFocus
login = txtLogin.Text
txtPassword1.SetFocus
thepassword1 = txtPassword1.Text
txtPassword2.SetFocus
thepassword2 = txtPassword2.Text
txtLogin.SetFocus
validLogin = DLookup("LoginName", "[tblLogin]", "LoginName = " & txtLogin.Text)
MsgBox "validLogin"
If validLogin = login Then
correctPassword1 = DLookup("password1", "[tblLogin]", "LoginName = " & txtLogin.Text)
correctPassword2 = DLookup("password2", "[tblLogin]", "LoginName = " & txtLogin.Text)
If ((thepassword1 = correctPassword1) And (thepassword2 = correctPassword2)) Then
MsgBox "Correct Passwords Entered"
Else
MsgBox "Incorrect Passwords"
End If
Else
MsgBox "Invalid User Name"
End If
End Sub
The highlighted line is the 1st DLookUp line. Please tell me what's wrong.
Max
Here's the code:
Private Sub cmdLogin_Click()
Dim query As String
Dim login As String
Dim thepassword1 As String
Dim thepassword2 As String
Dim validLogin As String
Dim correctPassword1 As String
Dim correctPassword2 As String
txtLogin.SetFocus
login = txtLogin.Text
txtPassword1.SetFocus
thepassword1 = txtPassword1.Text
txtPassword2.SetFocus
thepassword2 = txtPassword2.Text
txtLogin.SetFocus
validLogin = DLookup("LoginName", "[tblLogin]", "LoginName = " & txtLogin.Text)
MsgBox "validLogin"
If validLogin = login Then
correctPassword1 = DLookup("password1", "[tblLogin]", "LoginName = " & txtLogin.Text)
correctPassword2 = DLookup("password2", "[tblLogin]", "LoginName = " & txtLogin.Text)
If ((thepassword1 = correctPassword1) And (thepassword2 = correctPassword2)) Then
MsgBox "Correct Passwords Entered"
Else
MsgBox "Incorrect Passwords"
End If
Else
MsgBox "Invalid User Name"
End If
End Sub
The highlighted line is the 1st DLookUp line. Please tell me what's wrong.
Max