Run-time error '3464'

Hauler2me

New member
Local time
Today, 12:36
Joined
May 21, 2015
Messages
9
I keep getting this "Run-time error '3464'" and I will take the "cap of shame":banghead: if this is the easiest fix ever. Nonetheless :) I still am appreciated of any help I can get on this.





Private Sub Command1_Click()
Dim UserLevel As Integer
Dim TempPass As String
Dim ID As Integer
Dim EmpName As String
Dim TempLogin As String


If IsNull(Me.txtEmpLoginID) Then
MsgBox "Please enter Employee Login ID.", vbInformation, " Required"
Me.txtEmpLoginID.SetFocus
ElseIf IsNull(Me.txtPassword) Then
MsgBox "Please enter password", vbInformation, "Password Required"
Me.txtPassword.SetFocus
Else
'process the job

If (IsNull(DLookup("EmpLoginID", "tblEmployee", "EmpLoginID='" & Me.txtEmpLoginID.Value & "'"))) Or _
(IsNull(DLookup("EmpPassword", "tblEmployee", "EmpPassword ='" & Me.txtPassword.Value & "'"))) Then
MsgBox "Invalid Employee ID or Password"
Else
TempLoginID = Me.txtEmpLoginID.Value
EmpName = DLookup("[EmpName]", "tblEmployee", "[EmpLoginID] = '" & Me.txtEmpLoginID.Value & "'")
UserLevel = DLookup("[EmpSecurity]", "tblEmployee", "[EmpLoginID] = '" & Me.txtEmpLoginID.Value & "'")
TempPass = DLookup("[EmpPassword]", "tblEmployee", "[EmpLoginID] = '" & Me.txtEmpLoginID.Value & "'")
ID = DLookup("[EmployeeID]", "tblEmployee", "[EmployeeID] = '" & Me.txtEmpLoginID.Value & "'")
DoCmd.Close
If (TempPass = "password") Then
MsgBox "Please change Password.", vbInformation, "New Password Required!"
DoCmd.OpenForm "frmEmployeeInfo", , , "[EmployeeID]" = " & ID"
Else
If UserLevel = 1 Then 'App admin
DoCmd.OpenForm "Login Navigation Form"
Forms![login Navigation Form]![txtLoginID] = TempLoginID
Forms![login Navigation Form]![txtEmpLogin] = EmpName
Else
'
DoCmd.OpenForm "Login Navigation Form"
Forms![login Navigation Form]![txtLoginID] = TempLoginID
Forms![login Navigation Form]!NavigationButton11.Enabled = False
Forms![login Navigation Form]![txtEmpLogin] = EmpName
End If
End If
End If
End If
End Sub
 

Attachments

i would say the EmployeeID is numeric and does NOT need quotes around it, so

DLookup("[EmployeeID]", "tblEmployee", "[EmployeeID] = " & Me.txtEmpLoginID)

(and value is the default property)
 
Code:
ID = DLookup("[EmployeeID]", "tblEmployee", "[EmployeeID] = '" & Me.txtEmpLoginID.Value & "'")

Ran caught the syntax error, but missed the logical one. I believe you want:

Code:
ID = DLookup("[EmployeeID]", "tblEmployee",  "[EmpLoginID] = '" & Me.txtEmpLoginID.Value & "'")

No point looking up a value you already have.
 
i would say the EmployeeID is numeric and does NOT need quotes around it, so

DLookup("[EmployeeID]", "tblEmployee", "[EmployeeID] = " & Me.txtEmpLoginID)

(and value is the default property)

That didn't seem to work... I get run-time error '2471'
 
Code:
ID = DLookup("[EmployeeID]", "tblEmployee", "[EmployeeID] = '" & Me.txtEmpLoginID.Value & "'")

Ran caught the syntax error, but missed the logical one. I believe you want:

Code:
ID = DLookup("[EmployeeID]", "tblEmployee",  "[EmpLoginID] = '" & Me.txtEmpLoginID.Value & "'")

No point looking up a value you already have.


A little closer... i get run-time error '2465' this time and the debug is
If UserLevel = 1 Then 'App admin
DoCmd.OpenForm "Login Navigation Form"
Forms![login Navigation Form]![txtLoginID] = TempLoginID
Forms![login Navigation Form]![txtEmpLogin] = EmpName
 
;) I am up and running now. Thank you plog, and Ranman256 for your quick reply.

What caused all this for me was the login header textbox named txtNAVEmpLoginID. You all probably hate the fact that it was a name thing and that I used up some of your valuable time. I thank you for your thoughts and input.;)
 

Users who are viewing this thread

Back
Top Bottom