472,958 Members | 2,335 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,958 software developers and data experts.

How to delete duplicate records and leave one?

KT
Is there any one click solution that would do the trick? I would like
to create a button, so the person who maintains the database can
perform clean up work to delete duplicate records which contain same
information in the ID field and the account number field once a week.

Thanks in advance!

KT
Nov 13 '05 #1
4 6108
"KT" <ka****@rocketmail.com> wrote in message
news:fe***********************@posting.google.com. ..
Is there any one click solution that would do the trick? I would like
to create a button, so the person who maintains the database can
perform clean up work to delete duplicate records which contain same
information in the ID field and the account number field once a week.

Thanks in advance!

KT


There is if you don't care which of the duplicate records get deleted.
However, often with "duplicate records" they are not exact duplicates and so
one record is often the best one to keep. E.g. one of the contact records
has a phone and fax number and one only has a phone number.
Anyway, by the looks of things you might be able to alter your database
design so that these sort of duplicates cannot be entered in the first
place, rather than trying to fish them out once a week.
Nov 13 '05 #2
Short answer: no.
Longer answer: your database is not designed right. That's what
primary keys are all about. "but I need an autonumber..." yeah yeah
yeah. create an autonumber to base the relationships on, make it
unique, so it can act as a surrogate PK. Then make the PK the
smallest combination of all the fields that guarantee a record's
uniqueness. Jet already does the enforcement of uniqueness for you.
You should use it.
Nov 13 '05 #3
KT
pi********@hotmail.com (Pieter Linden) wrote in message news:<bf**************************@posting.google. com>...
Short answer: no.
Longer answer: your database is not designed right. That's what
primary keys are all about. "but I need an autonumber..." yeah yeah
yeah. create an autonumber to base the relationships on, make it
unique, so it can act as a surrogate PK. Then make the PK the
smallest combination of all the fields that guarantee a record's
uniqueness. Jet already does the enforcement of uniqueness for you.
You should use it.


Thanks a lot! I think I got it! So I could use combination of fields
as PK to avoid that from happening at the first place...That table I
am working on is the 'many' table from a one to many relationship,
that's why it sometimes has duplicate IDs.

I was worrying about this issue also because I will import tables
frequently (like twice a month), and tables that I import will contain
records that I will have already imported (archive), so is setting up
PK with combinations of fields gonna take care of that too?
Nov 13 '05 #4
ka****@rocketmail.com (KT) wrote:
I was worrying about this issue also because I will import tables
frequently (like twice a month), and tables that I import will contain
records that I will have already imported (archive), so is setting up
PK with combinations of fields gonna take care of that too?


Setting up the PK should at least help. To better answer that
question, perhaps you could expound a little as to what is contained
in this table and the nature of the data in the tables that you will
be importing.

For instance, each time you import and you already have some of the
records from your previous import, could the data for those records
have changed since the last import? If not, then you only need to
import those records which have never been imported before.

Perhaps you are importing multiple copies of the tables from different
sources at the same time (as you would if you were importing data from
5 different Customer tables, one from each of 5 different sales
regions). If each table contained data about mutually exlusive
customers, then you don't have a problem.

However, if each copy could contain data about the same customer, then
you have to figure out which copy has the newest info about that
particular customer. And if each location could independently update
that same customer, then you'd have to figure out what changes each
location did to that customer, and import the accumulated changes.
This would be quite an involved process.
Nov 13 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: ms | last post by:
Access 2000: I am trying to delete duplicate records imported to a staging table leaving one of the duplicates to be imported into the live table. A unique record is based on a composite key of 3...
6
by: Paul T. Rong | last post by:
Dear all, Here is my problem: There is a table "products" in my access database, since some of the products are out of date and stopped manufacture, I would like to delete those PRODUCTS from...
3
by: rajeshkrsingh | last post by:
Hi friends, Step1- create table duplicate ( intId int, varName varchar(50) ) insert into duplicate(intId,varName) values(1,'rajesh') insert into duplicate(intId,varName) values(2,'raj12')...
7
by: AccessHunter | last post by:
I am using the following code to find and delete records in a table. The logic will go through each record and if a duplicate row is found will delete it. I ran this code and it worked the first...
7
by: jmstur2 | last post by:
I have a table with what I consider duplicate records. Data in all columns are duplicate except for the date column, meaning that duplicate data was entered on different dates and those dates were...
2
by: farouqdin | last post by:
Hi all i have code which loops through table and deletes the duplicate records. This code does it for one table. How do i change it so it goes through several tables? On Error Resume Next Dim...
4
by: ramdil | last post by:
Hi All I have table and it have around 90000 records.Its primary key is autonumber field and it has also have date column and name, then some other columns Now i have problem with the table,as my...
6
by: Dilip1983 | last post by:
Hi All, I want to delete duplicate records from a large table. There is one index(INDEX_U1) on 4 columns(col1,col2,col3,col4) which is in unusable state. First of all when i tried to rebuild...
1
watertraveller
by: watertraveller | last post by:
Hi all. My ultimate goal is to return two columns, where no single value appears anywhere twice. This means that not only do I want to check that nothing from column A appears in column B and...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
2
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.