I am trying to make sure no duplicate records are entered. I am not sure where to put my dlookup code. I have beforeupdate macros for some fields to copy the previous record fields to the new record fields. If I put this code in those fields as a beforeupdate event, I get this error: "Procedure Declaration does not match descritpion of event or procedure have the same name." If I put this code in another event procedure, it doesn't do anything. Please help! Thank you.
If (Not IsNull(DLookup("[EmployeeID]", "WSbyEmployee", "[EmployeeID] ='" & Me!EmployeeID.Int & "'"
)) Then
MsgBox "Data Entry Error. You have entered a duplicate record. Please check the timesheet to be certain you have not already entered this information."
Cancel = True
Me!EmployeeID.Undo
End If
If (Not IsNull(DLookup("[EmployeeID]", "WSbyEmployee", "[EmployeeID] ='" & Me!EmployeeID.Int & "'"
MsgBox "Data Entry Error. You have entered a duplicate record. Please check the timesheet to be certain you have not already entered this information."
Cancel = True
Me!EmployeeID.Undo
End If