Check for Duplicate Employee Before Update

  • Thread starter Thread starter Dave Elliott
  • Start date Start date
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
 
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
 
Back
Top