Check for Duplicate Employee Before Update

D

Dave Elliott

I have a form named Employees where I enter employee data. I would like for
it to check for duplicate employees before I enter all the employee info and
try and save the record. The unique employee identifier is a field named
Employee ID and the control source is ID Number.This field is limited to a 5
character employee identifier. The table it is based on is named Employees.
The query that contains the table employees is named EmployeeInfo.
I tried a macro, but it didn't work. I used this code, on the after update
event of the field ID Number where you enter a 5 character employee id.
DLookUp("[ID Number]","[Employees]","[ID Number] = Form.[ID Number] ") Is
Not Null

How can I do this ?


Thanks,
Dave
 
M

Mike D

You need to set the index on the employee ID and set this to allow no
duplicates.

This should take care of it.

IF this isnt what you are looking for you can do an on update event of the
record to check it there
 

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