现在工作了一段时间,我收到运行时错误 2501
在消息框出现并指出已找到重复项并单击“确定”后,我正在尝试提取记录。
我一直在修补 DoCmd.FindRecord、DoCmd.GoToRecord 和 DoCmd.OpenForm 方法,但无济于事。
任何帮助将不胜感激。
提前致谢。
Private Sub MRN_BeforeUpdate(Cancel As Integer)
Dim Answer As Variant
Answer = DLookup("[MRN]", "Requests Processed", "[MRN] = '" & Me.MRN & "'")
If Not IsNull(Answer) Then
MsgBox "Existing MRN found" & ": " & MRN.Text & vbCrLf & vbCrLf & "Please SEARCH and EDIT on EXISTING Record.", vbCritical + vbOKOnly + vbDefaultButton1, "EXISTING MRN FOUND"
Cancel = True
Me.MRN.Undo
Else:
End If
DoCmd.OpenForm "Requests Processed", , , Answer
End Sub