Hi,
I've got a form that sits on the top of a table (company_table). Will (eventually) allow the user to add a new company to the table by entering a text name in the control Company_Name.
I'm to put a bit of logic together that will stop duplicate records being created. I thought i would use DCount for this but the following statement always evaluates to true (i.e. the message box always comes up) no matter what i enter in the Me.Company_Name field.
Any help on where i am going wrong?
Thanks
J
I've got a form that sits on the top of a table (company_table). Will (eventually) allow the user to add a new company to the table by entering a text name in the control Company_Name.
I'm to put a bit of logic together that will stop duplicate records being created. I thought i would use DCount for this but the following statement always evaluates to true (i.e. the message box always comes up) no matter what i enter in the Me.Company_Name field.
Any help on where i am going wrong?
Code:
If DCount("[company_name]", "company_table", Me.Company_Name) > 0 Then
MsgBox "This Company Already Exists!"
End If
Thanks
J