أرجو أن يكون هذا مبتغاك
Private Sub Name_BeforeUpdate(Cancel As Integer)
Dim SearchResult As String, DestinationCode As Integer
SearchResult = Nz(DLookup("[code_no]", "[Personal data]", "[Name]=form![Name]"), "")
If SearchResult <> "" Then
MsgBox "هذا الإسم موجود من قبل !"
DestinationCode = CInt(SearchResult)
Me.Undo
DoCmd.GoToRecord acDataForm, Me.Name, acGoTo, DestinationCode
End If
End Sub
___.zip