Hi everybody !

I want to verify in one database if there is identical records and keep only one of them...

Here below it's what I tried (Sorry some words are in french):

VB Code:
  1. 'Instanciation des variables
  2. Set cn = New ADODB.Connection
  3. Set cn1 = New ADODB.Connection
  4. Set rs = New ADODB.Recordset
  5. Set rs1 = New ADODB.Recordset
  6. 'Connection Database
  7. cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & ImpressionMDB
  8. cn.Open
  9. cn1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & ImpressionMDB
  10. cn1.Open
  11. 'Ouverture des recordset
  12. rs.Open "Items", cn, adOpenKeyset, adLockPessimistic, adCmdTable
  13. rs1.Open "Items", cn1, adOpenKeyset, adLockPessimistic, adCmdTable
  14. 'Vérifier si item identique
  15. rs.MoveFirst
  16.         Do Until rs.EOF
  17.                 rs1.MoveFirst
  18.                 Do Until rs1.EOF
  19.                         [U]If rs.Fields("Description").Value = rs1.Fields("Description").Value Then[/U]
  20.                                 rs.Delete
  21.                         End If
  22.                         rs1.MoveNext
  23.                 Loop
  24.                 rs.MoveNext
  25.         Loop
  26. 'Fermeture de la connection
  27. cn.Close
  28. cn1.Close
  29. rs.Close
  30. rs1.Close
  31. Set cn = Nothing
  32. Set cn1 = Nothing
  33. Set rs = Nothing
  34. Set rs = Nothing
I got an error on the underlined line:

Runtime Error -2147217885 (80040e23) : A Given HROW Referred to a Hard-Deleted or Soft-Deleted Row

If you have other suggestion, let me know !

Thanks in advance !