I have a field that permits duplicate records but I need to be warned when I enter a duplicate number. I used old posts to try to solv this problem but I keep getting the message "Procedure declaration does not match description of event or procedure having the same name" (with different codes). The field is named "NSC" and the table "1 - Principal". The code I used was:
Can anybody tell me what am I doing wrong
Code:
Private Sub NSC_BeforeUpdate()
Dim rslt As Integer
If Nz(DLookup("[NSC]", "1 - Principal", "[NSC]=" & Me.NSC), 0) <> 0 Then
rslt = MsgBox("Este NID já foi introduzido previamente. Deseja continuar?", vbYesNo)
If rslt = vbNo Then
Me.RecNo = Null
Me.RecNo.SetFocus
End If
End If
End Sub
Comment