I have this code that prevents the user to duplicate entries at runtime. The problem is that I had to disable the REQUIRED property in the table. Now users can bypass this field without keying any data. Any suggestions on how to programically trigger the REQUIRED property would be appreciated.
Thanks in advance.
Thanks in advance.
Code:
Private Sub Invoice_Number_BeforeUpdate(Cancel As Integer)
Dim intMsg As Integer
Dim intTitle As String
If Not IsNull(DLookup("[Invoice Number]", "Freight", "[Invoice Number]= '" & Me![Invoice Number] & "' And [Carrier Name]= '" & Me![Carrier Name] & "'")) Then
intMsg = MsgBox("Duplicate invoice detected.", vbInformation, "Duplicate Invoice!")
Me.[Invoice Number].Undo
Cancel = True
End If
End Sub