I have the following code attached to an annual leave form, to prevent duplicate entries. However, the problem I am having is that it returns a run-time error when i try to test it by putting in a duplicate record. Anyone have any ideas as to what I may have done wrong?
Code:
Private Sub StartDate_Change()
If DCount("*", "Tbl_Calendar", "EmployeeID =" & Me.EmployeeID & "And StartDate = #" & Me.StartDate & "#") > 0 Then
'...Duplicate entry not found process onwards...
Else
MsgBox "...Duplicate Entry..."
Me.Undo
End If
End Sub