1

Access complains "Data Type Mismatch in criteria expression" with this code ...

If DCount("[Serial Number]", "INVENTORY OVERVIEW", "[Serial Number] =" & Val(txtSERIAL)) > 1 Then

Serial Number is the field I'm trying to count. INVENTORY OVERVIEW is the table where I am trying to do the count. txtSerial is the text box on a userform.

The objective of this if statement is to determine if there are more than one of the same serial number, and report to the user when they submit a new entry if that serial number already exists within the recordset.

HansUp
  • 95,961
  • 11
  • 77
  • 135

1 Answers1

-1

you have to add the quotes to the txt object. So: "[Serial Number] ='" & Val(txtSERIAL) & "'")) > 1