I'm using that method (creating a unique index) for already existing tables. I mean without changing the original table.
If you able to change / redesign your table you can add a unique index on multiple fields. So inserting duplicate records gives a warning like 'Duplicate key was ignored', but no error.
For example:
CREATE TABLE phonebook (
[phonenumber] [varchar] (30),
[firstname] [varchar] (30),
[lastname] [varchar] (30),
[company] [varchar] (100)
)
CREATE UNIQUE INDEX IX_Unique ON phonebook (firstname, lastname) WITH IGNORE_DUP_KEY
But do not forget that, ADO will take 'Duplicate key was ignored' warning as an error!
So you should take care of this in your application.
A VB6 example;
Const cnstError_DuplicateKeyWasIgnored As Long = 3604
'...
On Error GoTo ADO_ERROR
Call oCON.Execute(strAnInsertSql)
On Error GoTo E 'Normal error handler
'...
ADO_ERROR:
If oCON.Errors(0).NativeError = cnstError_DuplicateKeyWasIgnored Then
'Duplicate Key Was Ignored errors should be ignored
Resume Next
End If