dlookup function only check first record in a table


G

Guest

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
 
Ad

Advertisements

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])
 
Ad

Advertisements

G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top