What program was the database created in?

If it was created in Access there is a feature where you can specify that duplicates are not allowed for a field. Then, in the sub where you were using SQL just put an error handler that displays a message box 'Duplicates are not allowed' or some such and exit the sub.

Hope that helps.

Eva