Prevent duplicates based on two criteria

Joined
Apr 13, 2012
Messages
8
Reaction score
0
I have the following code:

Private Sub txtWWID_BeforeUpdate(Cancel As Integer)
If DCount("WWID", "Updated Headcount", "[WWID] = '" & Me.txtWWID & "'") > 0 Then
MsgBox ("This Value Already Exists! Please Enter New Value")
Cancel = True
End If
End Sub

I need to add a second criteria though. When the user types in a value, I need to check if it is in the WWID column and if it is then check if there is a 1 in the Number column.

If both are true then I need to prevent the user from submitting the value.
 
Back
Top