Getting rid of dups...

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I know the algorithm is out there somewhere, and I don't want to re-invent the wheel. How do I check for dups, and then remove all dups, BUT one? I mean, I can delete all the the records that are dup'ed, but I don't know how to erase every dup'ed record except one

Anyone knows or can point me to a link with the alogrithm

Thanks a million in advance!
 
I am actually trying to remove dups. As in any other database on people, our database is filled with dups. I just want to get rid of the rest but keep one.

But thanks for pointing out distinct though.
 
a simple solution

dim rs as dao.recordset
dim oldval as string

set rs = currentdb.openrecordset("SELECT * FROM XXX ORDER BY
DUPFIELD",dbOpenDynaset)
While Not Rs.EOF
if Rs.Fields("DupField").Value = oldval Then
rs.delete
else
oldval=rs.fields("DupField").Value
end if
rs.movenext
wend
rs.close : set rs = nothing

HTH

--
Pieter Wijnen

When all else fail try:
http://www.mvps.org/access
http://www.granite.ab.ca
http://allenbrowne.com/



anthony said:
I am actually trying to remove dups. As in any other database on people,
our database is filled with dups. I just want to get rid of the rest but
keep one.
 
Back
Top