I am sure there is a thread related to this and I apologize for adding this thread if there is. I am having problem with duplicate detect. I have written a some VBA code to detect if a school name exist in the account table. The problem is I get my error messge ever time I enter a different school name. No matter is the school name is in the table I still get my error message. Am I doing somthing wrong?
Here is my code
If DCount("*", "tblAccount", "[accSchoolName]=[accSchoolName]") > 0 Then
MsgBox "School already exist, please enter an new school name to continue. ", vbOKOnly + vbInformation, "School Already Exist!"
Me.Undo
Me.frmSubSystem.Locked = True
End If
Here is my code
If DCount("*", "tblAccount", "[accSchoolName]=[accSchoolName]") > 0 Then
MsgBox "School already exist, please enter an new school name to continue. ", vbOKOnly + vbInformation, "School Already Exist!"
Me.Undo
Me.frmSubSystem.Locked = True
End If