B
BRC
Hi all
I am using the following code to check for duplicate record and if it
exists I want to display it in the form. It finds the duplicate (if
it exists) as it should however when the sub ends the form is at the
1st record in the of the query. I would think that it would display
the record it found with the "bookmark". What am i missing? Thanks
for any help.
Code by Keri Hartwell (with slight modifications
Private Sub event_AfterUpdate()
Dim dcvar As String
dcvar = Me.[date] & " " & Me.event
Me.DupChk = dcvar
Dim rst As Recordset
Set rst = Me.RecordsetClone
rst.FindFirst (DupChk = dcvar)
If Not rst.NoMatch Then
MsgBox "Record Exists"
Cancel = True
Me.Undo
Me.Bookmark = rst.Bookmark
End Sub
I am using the following code to check for duplicate record and if it
exists I want to display it in the form. It finds the duplicate (if
it exists) as it should however when the sub ends the form is at the
1st record in the of the query. I would think that it would display
the record it found with the "bookmark". What am i missing? Thanks
for any help.
Code by Keri Hartwell (with slight modifications
Private Sub event_AfterUpdate()
Dim dcvar As String
dcvar = Me.[date] & " " & Me.event
Me.DupChk = dcvar
Dim rst As Recordset
Set rst = Me.RecordsetClone
rst.FindFirst (DupChk = dcvar)
If Not rst.NoMatch Then
MsgBox "Record Exists"
Cancel = True
Me.Undo
Me.Bookmark = rst.Bookmark
End Sub