skeddy<br>
Just use the BeforeUpdate event of the control. Then, if whatever validation you have fails, set the passed-in variable Cancel to True. Put up any message you like. If you're specifically looking to avoid the 'duplicate' message, then open a table-type recordset over the table in question, set the Index to PrimaryKey, and do a Seek to see if the newly entered value exists, then put your message up:<br>
<br>
sub txtKeyField_BeforeUpdate(cancel as integer)<br>
Dim rst as recordset<br>
set rst = currentdb.openrecordset("mytable",dbOpenTable)<br>
rst.Index = PrimaryKey 'or the name of the PK index if you renamed it from this default<br>
rst.seek "=",me!txtKeyField<br>
if rst.nomatch then<br>
Exit Sub<br>
else<br>
msgbox "The value " & me!txtKeyField & " already exists, blah, blah."<br>
Cancel = True<br>
End if<br>
End Sub