Setting the primary key on the field you don't want to duplicate.
Otherwise, error trapping (perhaps write a function that passed the autonumber and sees if it's returned (true/false)
Function CheckForDuplicate(IDAutoNumberField as variant) as boolean
dim rs as adodb.recordset
set rs = new adodb.recordset
dim strSQL as string
strSQL = "Select * from MyTableName where MyIDAutonumberField = " & IDAutoNumberField & ""
rs.open strsql,currentproject.connection, adopenkeyset, adlockreadonly
if rs.eof and rs.bof the
msgbox "There are no records."
CheckForDuplicate = fase
msgbox "There are records."
CheckForDuplicate = true
set rs = nothing
Expert Database Programming
MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)