Deleting all duplicates

M

Mike

I have a report that I run weekly in Excel and import it into Access. The
primary key is the customer number, and the constant should be the order
date. Since the report pulls all information old and new, I have to be
careful and delete all the information from last week.

Problem occurred when employees started to change the order date on the
customer numbers and now we have duplicates that are hard to find and we can
no longer sort by dates to remove duplicates.

I want to create a query that only pulls the records that do not have
duplicates, or one that deletes any record with a duplicate as well as the
duplicate.

Please help if you can, I'm in a crunch.
 
A

Arvin Meyer [MVP]

You know that your problem would be much simpler if you could just use
Access as it was intended and do the orders in Access in the first place.
There should never be a reason to create 2 records with 2 different order
dates for the same order. Still, until you are able to fix the source of the
problem, I suggest that you use an autonumber as your primary key, and run a
duplicates query (from the query wizard), using the Order number as the
field to check for duplicates. If you have subtable records, turn on
cascading deletes and delete the earlier record in the query.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top