I have designed a database with Master Table as my table name. I have set up an add record button which I need to have prompt someone when they have entered a duplicate Paymode ID number.
This is the code I have but it is giving an error for ANY number entered into this field even if it's not a duplicate.
Private Sub Paymode_ID_BeforeUpdate(Cancel As Integer)
If IsNull(DLookup("[Paymode_ID]", _
"Master Table", _
"[Paymode_ID] = """ & Me.Paymode_ID.Text & """")) = False Then
Cancel = True
MsgBox "Paymode_ID already exists", vbOKOnly, "Warning"
Me![Paymode ID].Undo
End If
End Sub
Please help!