Here is the code I'm using:
It looks proper but I keep getting this message: You Canceled the Previous Operation
What I'm trying to do is verify that a project number is not in the table before I let the user proceed. The project number is part of the primary key which consists of two fields, however, I want to verify that project number is correct or not already listed first before the user continues. Am I getting this message because I'm trying to count records in the same table I'm updating? Or do I need to turn on a reference?
Code:
If DCount "[COPProjectNo]", "tbStoredProjectNo", "[COPProjectInfo] = '" & Me.Text52 & "'") > 0 Then
MsgBox "The Project No You Enter already Exist. Please Verify Project No and Re-Enter", vbCritical
Else
End If
It looks proper but I keep getting this message: You Canceled the Previous Operation
What I'm trying to do is verify that a project number is not in the table before I let the user proceed. The project number is part of the primary key which consists of two fields, however, I want to verify that project number is correct or not already listed first before the user continues. Am I getting this message because I'm trying to count records in the same table I'm updating? Or do I need to turn on a reference?