Code:
Dim irecct As Integer
Dim Response As Integer
Dim strLinkCriteria As String
Dim rsc
Set rsc = Me.RecordsetClone
If Me.Dirty = True Then
strLinkCriteria = "[firstname] = '" & Me.firstname & "' AND [secondname] = '" & Me.secondname & "'"
irecct = DCount("*", "qrymain", strLinkCriteria)
If irecct > 0 Then
Response = MsgBox("Someone with that name exists. Continue (YES) or Cancel record and go to existing person (NO)", vbYesNo, "Continue")
If Response = vbYes Then
Else
Me.Undo
rsc.FindFirst strLinkCriteria
Me.Bookmark = rsc.Bookmark
End If
End If
End If
use this code instead, it will prompt you to go to the existing record or continue doing what you're doing