The below code is telling me at I have a duplicate record whenever I am editing an existing record.
I want to catch the duplicate entry before the user goes into the next field on the record.
If the record already exists and I'm thinking about making a change to the field, maybe adding a space, but then I reconsider and undo the change, is there a way to better handle it?
I want to catch the duplicate entry before the user goes into the next field on the record.
If the record already exists and I'm thinking about making a change to the field, maybe adding a space, but then I reconsider and undo the change, is there a way to better handle it?
Code:
Private Sub Organization_BeforeUpdate(Cancel As Integer)
'https://access-programmers.co.uk/forums/showthread.php?t=82326
If DCount("*", "[t_Organization]", "[Organization]= " & Chr(34) & Me![Organization] & Chr(34)) > 0 Then
MsgBox "Duplicate organization. Filter for the organization and confirm you need a separate entry.", vbInformation, "Message"
End If
End Sub