Prevent duplicates based on two criteria

Apr 13, 2012
Reaction score
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.

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question