I have this code(below) and when i try and activate it it come up with runtime error- 3021 no current record and when i debug it highlights Me.Bookmark = rsc.Bookmark and i don't know what to do because i am very new to access. Please tell me in very simple terms. The code works until i use it in the switchboard and then the error appears.
Private Sub Document_ID_BeforeUpdate(Cancel As Integer)
Dim SID As String
Dim stLinkCriteria As String
Dim rsc As DAO.Recordset
Set rsc = Me.RecordsetClone
SID = Me.[Document ID].Value
stLinkCriteria = "[Document ID]=" & "'" & SID & "'"
'Check [ECNs Pending] table for duplicate [Document ID]
If DCount("[Document ID]", "[ECNs Pending]", _
stLinkCriteria) > 0 Then
'Undo duplicate entry
Me.Undo
'Message box warning of duplication
MsgBox "Warning Document ID " _
& SID & " has already been entered." _
& vbCr & vbCr & "You will now been taken to the record.", _
vbInformation, "Duplicate Information"
'Go to record of original Document ID
rsc.FindFirst stLinkCriteria
Me.Bookmark = rsc.Bookmark
End If
Set rsc = Nothing
End Sub