Bookmark???

T

Trini Gal

Hello,

My problem is I have the following code, which checks to see if there are
any duplicate data entries in my database. If there is, the user is taken to
the existing data. When the user is taken to the exiting data, another
message box pops up saying "You can't go to the specified record."...but
thats after they are taken to the duplicate data.

Private Sub Form_BeforeUpdate(Cancel As Integer)

Dim varADDRESS As Variant

If Me.NewRecord Then

varADDRESS = DLookup("[ADDRESS]", "LEAKS FOUND", "[ADDRESS] = '" &
Me.ADDRESS _
& "' and [STREET] = '" & Me.LOCATION & "' and [STREET1] = '" &
Me.STREET1 _
& "'")

If Not IsNull(varADDRESS) Then

If MsgBox("This record already exists." & _
"Do you want to cancel these changes and go to that
record instead?", _
vbQuestion + vbYesNo, _
"Duplicate Address Found") _
= vbYes _
Then
Cancel = True
Me.Undo
Me.Recordset.FindFirst "[ADDRESS]='" & varADDRESS & "'"
End If

End If

I was told that I need to use a recordset clone and bookmarks, but I don't
know how to do it. Can someone help me?

Thanks
 
Top