جرب
DoCmd.SetWarnings False
Dim x1
(x1 = Nz(DLookup("barcode", "tabl1", "[barcode] = " & Me.aa), 0)
If x1 = 0 Then
"MsgBox "This code is not registered", vbMsgBoxRight + vbCritical, "notes"
DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdDeleteRecord
else
MsgBox " This is a registered code", vbMsgBoxRight + vbCritical, "notes"
Exit Sub
End If