I would like to have one of my fields be checked for duplicates in the DB before the focus switches over to the next control. I was thinking about running an SQL query based the value entered.
The question is, how do I go about executing a query which I could get the count of the records it found. For example...
Dim count As Integer
count = <some code to execute a query>
If count > 1 Then
DCount("[FieldName]","tableName","[FieldName] = " & [ControlName]) if the field is numeric or
DCount("[FieldName]","tableName","[FieldName] = '" & [ControlName] & "'")
if the field is a string use # if it is a date