dlookup function only check first record in a table

D

Dave S

Help. I have a labor tracking database that I'm ready to roll out today and
I have one last error to correct.

I have a field for operators to enter their employee ID into. This will be
done with a bar code reader that also sends CR/LF to move to the next field.
I want to use a dlookup to make sure that the user exists in an "Associates"
table. The expression that I have built into the validation rule for this
control is:

=DLookUp("[Employee_ID]","Associates","[Employee_ID] = " &
[Forms]![Time_Data_Input_Form]![Employee_ID] Is Not Null)

This works fine but it will only check validity of the first record in the
database (whatever that is). It will NOT check any of the other records to
see if the employee ID entered is in the table.

What am I doing wrong? I need it to check and see if the employee ID
entered is a valid user in the database.

Thanks,
Dave
 
D

Douglas J. Steele

That's not a valid WHERE clause (the "Is Not Null" at the end is wrong,
since you're already comparing Employee_ID to the form control)

=DLookUp("[Employee_ID]","Associates","[Employee_ID] = " &
[Forms]![Time_Data_Input_Form]![Employee_ID])
 
D

Dave S

Thanks a lot, that worked just fine!!

Dave


Douglas J. Steele said:
That's not a valid WHERE clause (the "Is Not Null" at the end is wrong,
since you're already comparing Employee_ID to the form control)

=DLookUp("[Employee_ID]","Associates","[Employee_ID] = " &
[Forms]![Time_Data_Input_Form]![Employee_ID])

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Dave S said:
Help. I have a labor tracking database that I'm ready to roll out today
and
I have one last error to correct.

I have a field for operators to enter their employee ID into. This will
be
done with a bar code reader that also sends CR/LF to move to the next
field.
I want to use a dlookup to make sure that the user exists in an
"Associates"
table. The expression that I have built into the validation rule for this
control is:

=DLookUp("[Employee_ID]","Associates","[Employee_ID] = " &
[Forms]![Time_Data_Input_Form]![Employee_ID] Is Not Null)

This works fine but it will only check validity of the first record in the
database (whatever that is). It will NOT check any of the other records
to
see if the employee ID entered is in the table.

What am I doing wrong? I need it to check and see if the employee ID
entered is a valid user in the database.

Thanks,
Dave
 
Top