?
Solved

remove duplicates acess 2000

Posted on 2005-03-22
3
Medium Priority
?
142 Views
Last Modified: 2006-11-17
here i go.I have this table that i want to check for duplicate entries,the name,tblled,the fields with the duplicate entries are,dsdate,time,seq,deviceno, when the duplicates are found i would like to remove one of the entries to a table (tbldups) to be verified before i actually delete.I would like to attached the code to a cmdbutton,or if possilble have this done at the first of every month before i actually run reports.
thanks
0
Comment
Question by:wwstudioinc
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 3

Expert Comment

by:poaysee
ID: 13599969
Step 1:
you go to query, click on the new -> choose the "Find duplicates Query view" -> Choose the table or the query name you want to find the duplicate -> put in the field name which you want to check within those fields name -> save as a new query.
Step 2:
You link the original table/Query with the duplicate data, and check on the data
Step 3:
DoCmd.RunSQL "Delete From tableName where ... (condition)"
0
 
LVL 9

Expert Comment

by:solution46
ID: 13600107
qry 1 (qry_tblled_dups)...
SELECT Max([your_id_field]) row_id
FROM tblled
GROUP BY dsdate, [time], seq, deviceno
HAVING Count([your_id_field]) > 1

qry 2 (qry_tblled_listdups)...
INSERT INTO tbldups
SELECT *
FROM tblled
    INNER JOIN qry_tblled_dups
        ON tblled.[your_id_field] = qry_tblled_dups.row_id

qry 3 (qry_tblled_deldups)
DELETE FROM tblled
WHERE [your_id_field] IN (SELECT row_id FROM tbldups)

qry 4 (qry_tbldups_truncate)
DELETE FROM tbldups


Process...
1. run qry_tbldups_truncate
2. run qry_tblled_listdups
3. look through data in tbldups using a form or whatever. Delete any rows you want to leave in tblled.
4. run qry_tblled_deldups
5. run qry_tbldups_truncate


Notes...
1. This will only work if you have a unique id field ([your_id_field]) in the table tblled, or a group of fields that together form a unique id. Without this you have no way of isolating a single row and you wont be able to use a query or any other automated process to get rid of your duplicates.
2. tbldups must have exactly the same structure as tblled, and should ideally have [your_id_field] indexed.
3. All this is air code so check it for typos, etc., don't be surprised if there's a bug (if the cause isn't obvious, post it up here and I'll take a look) and back up your database before trying this!

Hope this helps,

s46
0
 
LVL 38

Accepted Solution

by:
puppydogbuddy earned 1500 total points
ID: 13600291
The link below gives you a tried and true step by step how to do it.
                      http://www.fabalou.com/Access/Queries/delete_dupe_records.asp
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question