473,473 Members | 2,174 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Deleting 1 of 2 identical records

1 New Member
Hi,

Is it possible to delete only 1 record when you have 2 duplicate records in a table. Normally i would do a group by query, but in some cases there are records where i want duplicates and also sometimes there are 3 duplicates and i only want to delete 1 of them.

Is this possible?

Thanks in Advance

Chris Clarke
Jan 22 '08 #1
1 1274
sierra7
446 Recognized Expert Contributor
Hi Chris

I would suggest there is something wrong with your database design if you WANT duplicate records. Most of us go to extreme lengths to PREVENT them !

If they arise from User input I would suggest you add a new field, call it X for the moment, then when the last user's field has been entered do something like;
Expand|Select|Wrap|Line Numbers
  1. Me!X = Dcount("AnyField","CurrentTableName","[Field1]=" & Me!Field1 & " and [Field2]=" & Me!Field2 & "etc, etc)
That way you will know which entries have duplicates and how many.

But I have no idea how you would deal with them

If the data is already entered I would use a similar approach (add field X ).
I would then create a Recordset based on a query where there is a sort on each field (effectively grouping the duplicates), then set-up a loop to compare each record with the next. (how many fields are you testing on?)

If the fields are the same then X= X+1, else X =0 and save each of the current fields as data for the next criteria

Can you manage the code?

Best of luck

S7
Jan 23 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Jerry Barnes | last post by:
Suppose that I have a table that contains a lot of records that are identical except for an id field and a date-time-stamp field. For example Id Unit Price DTS 1 A 1.00 Date 1 2 ...
0
by: Andre Doreid Berro | last post by:
Greetings All I am working on an Access database of contacts. I have plenty of records but plenty of them are almost duplicates. Data in some fields are misspelled and entered as completly...
1
by: Mark | last post by:
This question refers to a main form with a continuous form subform. After an error occurs after entering several records in the subform, how can I delete all the data in the main form and all the...
3
by: Nathan Bloom | last post by:
Hi, I have a data entry form (access 2000) that also allows the user to add, update, and delete records from the form. The Delete action is carried out in an event procedure and has the...
3
by: Mike Turco | last post by:
I'm working on an application that imports and exports tons of CSV data, like 64,000 records per file, and six or seven files in a set. First off, by the tine I import a few hundred thousand...
1
by: Coy Howe | last post by:
This one seems bizarre! We have a database consisting of a main table and 12 - 15 "sub" tables, which are connected via cascading relationships. The database performs many complex calculations...
1
by: KC | last post by:
Hello, I am using Access 2002. WinXP, Template from MS called Orders Mgmt DB. I have tweaked this DB to work for our small co. It has worked pretty well up until I made the mistake of deleting...
5
by: Mojtaba Faridzad | last post by:
Hi, with SetDataBinding( ) a DataGrid shows a DataView. user can select some rows in the grid by holding cotrol key. when user clicks on Delete button, I should delete all selected rows. I am...
11
by: shriil | last post by:
Hi I have this database that calculates and stores the incentive amount earned by employees of a particular department. Each record is entered by entering the Date, Shift (morn, eve, or night)...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.