Can anyone advise me what is wrong with this code? I want it to tell me if
I am entering a duplicate record. However, I always get the "Dupe" error
message, whether I have entered a duplicate or not.
The field REGISTRATION1 is in the form [Aircraft Registrations] and
Registration is the Control Source in the table [Aircraft Registrations]
(Can't remember why I named the two fields differently, but there was a
reason at the time)
thanks
Peter
Private Sub REGISTRATION1_AfterUpdate()
Dim strWhere As String
With Me.REGISTRATION1
If .Value = .OldValue Then
'do nothing
Else
strWhere = "Registration1 = """ & .Value & """"
If Not IsNull(DLookup("Registration", "[Aircraft
Registrations]", strWhere)) Then
MsgBox "Dupe!"
End If
End If
End With
End Sub