runtime ERROR 2471 in DLOOK

ian04

New member
Local time
Today, 18:03
Joined
Feb 14, 2016
Messages
3
Hi I would like to ask for help. I am trying to build my database but I am encountering run time error 2471 The expression you entered as a query parameter produce this error: 'KSE. "

I am trying to make Dlookup for EMP_Name field in my form when i enter value in EMP_ID. here's the code that I am using, hope that you can help me with this thanks a lot.

Private Sub txtEMPID_AfterUpdate()

Me.txtEMP_NAME = DLookup("EMP_Name", "Emp_Det", "Emp_ID=" & Me.txtEMPID)
End Sub
 
try enclosing it in Nz function, if dlookup does not find anything it will return a Null value.

Me.txtEMP_NAME =Nz( DLookup("EMP_Name", "Emp_Det", "Emp_ID=" & Me.txtEMPID), "")
 
I tried to use the code but Im still getting the same error
 
if Emp_ID field is text:

Me.txtEMP_NAME =Nz( DLookup("EMP_Name", "Emp_Det", "Emp_ID=" & CHR(34) & Me.txtEMPID & CHR(34)), "")

if error still occurs, maybe you your txtEMP_NAME control has an expression as its control source.
 
Thread moved to correct place. Ian please do not post technical queries in the introduction thread
 

Users who are viewing this thread

Back
Top Bottom