Removing Duplicates But Keeping Lastest Record
Dec 23, 2014
i have queries and tables with several duplicated "username" records. What should i do to remove the record with a smaller value of "win/loss" and keep the duplicated "username" with a bigger value of "win/loss".
View Replies
ADVERTISEMENT
May 10, 2005
High everyone I've had a look around the FAQ's and other threads but haven't been able to find what I'm looking for.
I have a table that contains two fields, one being 'part number' and the other being 'quantity'. Unfortunately there are multiple duplicate 'part numbers'. I am looking at keeping only one instance of the duplicate 'part numbers' but at the same time I want to add the 'quantities' together to keep a running total.
For example:
Before
Part Number Quantity
a1 1
a2 2
a3 2
a1 1
a2 1
a1 4
a1 1
After
Part Number Quantity
a1 7
a2 3
a3 2
Any help would be greatly appreciated.
Cheers
View 5 Replies
View Related
Sep 9, 2013
I'm trying to create ONE query which would fetch me the number of occurences on a particular value in a field while keeping duplicates.
For instance let's say i've got the following table
Color......Value
Red.........5
Red.........8
Orange....1
Then i would like to have the following result from my query
Color.........Value.......CountOfColor
Red............5..............2
Red............8..............2
Orange.......1..............1
I know i could achieve this by creating a view first. For instance by saving this expression as qryCountOfColors
Code:
SELECT tblColors.Color, Count(tblColors.Color) AS CountOfColor
FROM tblColors
GROUP BY tblColors.Color;
And then make the following query
Code:
SELECT tblColors.Color, tblColors.Value, qryCountOfColors.CountOfColor
FROM tblColors INNER JOIN qryCountOfColors ON tblColors.Color = qryCountOfColors.Color
However I'm woundering wheter or not I could achieve it without creating the qryCountOfColors.I'm myself into a mental meltdown . I've been playing with the idea of creating of creating a subquery to achieve this but im unable to get to work
Code:
SELECT tblColors.Color As BANANA, tblColors.Value, (SELECT Count(tblColors.Color) AS CountOfColor FROM tblColors GROUP BY tblColors.Color HAVING (((tblColors.Color)=BANANA))) AS Expr1
FROM tblColors;
View 2 Replies
View Related
Aug 14, 2006
I am running a query to return records from a table. I want to eliminate records from the query if the values contained in one field are duplicated. I have tried using the DISTINCT keyword but it only works if the entire record is unique or if I was retieving just one field
Any suggestions appreciated
View 1 Replies
View Related
Aug 19, 2004
Hi,
I'm running MS Access (2002 SP-2)
I have a table that has the following columns in it:
Sent NBR (text) / Sent Date (date/time) / PIC (text)
It's a customer listing of our customers and which long distance carrier they have selected. Unfortunately my data also shows OLD customers that no longer own that phone number. Because of this, various phone numbers are listed numerous times, but only the Sent NBR with the most current Sent Date is the one I need to see. The others are irrelevant and need to be deleted. I'd manually delete the duplicated Rows but I have over 115,000 duplicates!!
Do you guy know of a way to eliminated the duplicates for each Sent NBR and only show me the Sent NBR's with the Most current date?
Any help would be greatly appreciated!
Scott
View 9 Replies
View Related
Dec 12, 2011
I have data that I want to combine. However the separate data sets have some duplicates.
Let's say it is Customer Num field.
What I am saying is I am trying to combine the data sets to make a table with Customer Num and Customer Name.
I want to eliminate the duplicates. What is the best way to do this? Is there a feature in Access for this?
View 5 Replies
View Related
Aug 9, 2013
I have a table with few Employee ID re-appearing over and over again for two different job status.
Data Example
EMP ID Job Code Emp Name Country Job Status Time Spent (In Hrs)
222 9250 XYZ ABC Complete 6
222 1059 XYZ ABC InComplete 12
222 5050 XYZ ABC Complete 7
222 1050 XYZ ABC InComplete 9
111 2750 MNM IJK Complete 2
111 2150 MNM IJK InComplete 3
111 6550 MNM IJK Complete 7
111 8250 MNM IJK InComplete 9
I need an output which merges the data based on Emp ID, however, adds the time spent for completed and incompleted job status in 2 rows.
Output Requirement:
EMP ID Emp Name Country Job Status Time Spent (In Hrs)
222 XYZ ABC Complete 13
222 XYZ ABC InComplete 21
111 MNM IJK Complete 9
111 MNM IJK InComplete 12
Which query to use? I use Access 2010.
View 1 Replies
View Related
Jan 25, 2007
Hi,
just finding my way in Access 97 with no real support. I have made a query that creates duplicate records when I only need to see one for a certain criteria (lets say criteria X). This is due to the data feed involved in making the query where criteria X is found in numerous records.
What I want to display is only one record per entry containing an exact match for criteria X.
Finding it hard to articulate this but I would need something that defines:
If criteria X is the same, just display one record.
Hope this is somehow clear as I am struggling a bit. Would be gratefull of some help.
Thanks
View 3 Replies
View Related
Jun 17, 2013
I have created a database which is used as a sign in and out machine for students. I have 2 forms a 'sign in' which has a lookup list containing all student names. as well as date and time and a 'sign out form' which uses a lookup list from the sign in form.
It collects data fine but when a student signs in and out a second time there name is duplicated in the 'sign out' drop down list. The student must select the right name out of the duplicates otherwise it wont record.
Im just wondering if there is some sort of fix to this.
View 1 Replies
View Related
Jan 3, 2013
I am currently in the middle of creating a database as a means of keeping records of vouchers codes. When someone uses a voucher, I will then be able to input the name of the customer with the voucher code in the form.
This is meant to do two processes:
1. Keep a record of who has used a voucher
2. Check and validate the voucher code (the codes are kept in a table).
Now, I have created 90% of the db to input the customers details etc BUT...I am struggling for the validation part. Ideally, the db would also remove the said voucher code from the table so the same voucher code can not be used more then once.
I was going to "pre-install" the voucher codes in the db and then print off the vouchers for distribution. But I am basically tying to make the system so that it cannot be abused (for obvious reasons)...
View 1 Replies
View Related
Jan 10, 2005
When I ve gone in and deleted a record from my table (new table just testing it) ie. enter number 1 deleted it and than gone in and entered (on the form) another enter the (auto number) goes to 2.
I want to know how to i get it to go back to the previous number.
thanks
View 1 Replies
View Related
Oct 20, 2014
If there a way i can remove duplicates from an email list? I pull these emails from a recordset. But i email may appear more than once and it doesn't look good e.g
johndoe@mail.com;johndoe@mail.com;jo...hndoe@mail.com.
I'd like to remove the duplicated email, if its possible. Code below.
Code:
Set rs = CurrentDb.OpenRecordset("select * from query")
With objMailItem
If rs.RecordCount > 0 Then
rs.MoveFirst
Do
If Not IsNull(rs![email]) Then
vRecipientList = vRecipientList & rs![email] & ";"
rs.MoveNext
Else
rs.MoveNext
End If
Loop Until rs.EOF
.To = vRecipientList
View 6 Replies
View Related
May 2, 2014
I've been looking everywhere to find a better way of finding duplicates in a table and then recording and adding another value in that record together.
Let me try to explain better.
example:
I have a table that has 2 columns "Name", "DOB". I would like to find all duplicate "DOB" and add all of the "Name"'s together.
Quote:
Name DOB
bob 19800201
Sam 19761211
Jim 19800201
The output I would like is to have Name = bob & Jim DOB = 19800201.
I've tried using the find duplicate wizard in access but I can't seem to group them together and just to find the duplicates it takes upwards of a minute.
View 1 Replies
View Related
Feb 12, 2008
Hi this is my first post... so hi all :)
ok what i have is a table with contact details 900k plus
there are about 90k of which are duplicates.
this is the basic feilds that are important in this case.
Id, data_source, data_recived, data_code,
what i want is to have a table with unique records (no dups in data_code)
this table will look like this...
Id, data_code, Num_dups, dup1_source, dup1_date, daysbtw_Dup1_dup2, dup2_source, dup2_date, daysbtw_Dup2_dup3 ,dup3_source, dup3_date, daysbtw_Dup3_dup4 ,dup4_source, dup4_date,
I know there is no more than 4 dups of each record.
what i want from this is a table that will give me a record of how many dups for each record then all the dates that they were added and the date between each record entry.
if anyone can help it would be great .
thanks in advance.
View 6 Replies
View Related
Dec 8, 2005
Hey, all! Thanks for helping, here is my situation.
I have a table with about 70,000 records that have duplicate Address field values. The rest of the field values for those records are different. When I do a find duplicate querry I get the result that 17,000 records have the same address. However, when I do the append qurrey as instructed here: http://support.microsoft.com/?kbid=209183 I get a total of only 600 records in the new table. I have tried deleting all of the indexes for both the new and old table, with no luck.
I'm using Access 2000 on XP Pro.
If anyone could help with this I would greatly appreciate it!
Thanks
Will
View 14 Replies
View Related
Mar 8, 2005
hello all,
How does one keep log of what are the changes made to the access database in terms of the updates, appends etc..
please do help..
Thank you
View 1 Replies
View Related
Apr 20, 2006
When I open a Form, it appears in the proper size. Then, I go and open a Report, which is a DoCmd.Maximum on open. This works well. The report is enlarged. Now, when I go to open a form, the size of the form is max.
I tried Borderline dialog, fit window, DoCmd.MoveSize, and a couple of other things, but I cannot get those forms to keep their original size-they blow up!
How can this be accomplished?
View 1 Replies
View Related
Apr 20, 2006
When I open a Form, it appears in the proper size. Then, I go and open a Report, which is a DoCmd.Maximum on open. This works well. The report is enlarged. Now, when I go to open a form, the size of the form is max.
I tried Borderline dialog, fit window, DoCmd.MoveSize, and a couple of other things, but I cannot get those forms to keep their original size-they blow up!
How can this be accomplished?
View 2 Replies
View Related
Jun 6, 2005
Hi guys, I made an application consisting of an Access frontend with an MySQL db as backend. I have to deploy it through different offices in different cities and I would like to know how can I maintain the same .mdw (security file) for all the PCs. Some users will move constanly between offices and I need an easy way to maintaint the .mdw coherent between them, and I don't find how to do it. Hanging the .mdw on the web would be perfect (perhaps not for security, but I'm much more concerned about usability), but Access doesn't seem to allow it easily. Does anyone know how can I solve this problem? thx
View 1 Replies
View Related
Dec 22, 2005
I have 2 comboboxes (cboTeacher1 and cboTeacher2) and I do not want them to contain the same value. If the same value is chosen, I want a messagebox to show the error and keep the focus in the offending combobox.
I wrote the code below for cboTeacher1 and it functions in the case that your are making a selection in cboTeacher1; however, if you click ok on the msgbox and then press tab, the mesage box is not redisplayed and the focus is switched from cboTeacher1.
I tried placing the same code also in the cboTeacher_Exit event and when tabbing out of cboTeacher1, the msgbox is displayed, but the focus will not stay in cboTeacher1, it shifts to cboTeacher2.
How do I keep the focus locked in cboTeacher1 until both cboTeacher1 and cboTeacher2 contain different values.
Private Sub cboTeacher1_BeforeUpdate(Cancel As Integer)
If cboTeacher1.Column(1) = Me.cboTeacher2.Column(1) Then
' Both Primary and Secondary Teachers are the same
'Determine if either Teacher cbo contains a null value
If IsNull(cboTeacher1) = False Or IsNull(cboTeacher2) = False Then
' Alert the User of the discrepancy
MsgBox "You can not have the same teacher's name in bowth Primary and Secondary Teacher"
Me.SetFocus
End If
End If
End Sub
Thanks
View 11 Replies
View Related
Apr 5, 2006
How do I keep a form window always on top? Thanks..
View 3 Replies
View Related
Apr 30, 2008
Hi I have a table that looks like this
ordered_equip--------------2008------------2009-----------2010
itemCode1-------------------0----------------1--------------0
itemCode2-------------------0----------------2--------------1
itemCode3-------------------0----------------2--------------1
As you can see in the year 2010 items 2 and 3 go down from qty 2 to 1. What I am trying to do is to keep track of everything that was ever shipped to the customer. So with that in mind the above table is showing that Qty-2 was ordered in 2009 and Qty-1 was ordered in 2010. I want to add these as I go along. So my desired table would look like the following
ordered_equip--------------2008------------2009-----------2010
itemCode1-------------------0----------------1--------------1
itemCode2-------------------0----------------2--------------3
itemCode3-------------------0----------------2--------------3
in this table 2010 shows Qty-3 which means 2 was present on site in year 2009 and 1 more was added in 2010 to make the qty 3. I want to write a storedProcedure or something similar to convert the first table into the second table. I said storedProcedure because I am used to doing this in SQL Server.
View 4 Replies
View Related
Aug 2, 2005
Hi,
Can anyone help me please?
I have a combo box which displays the primary key. It then takes the other values from the cbo and then displays them in other text boxes in the form.
This is great.
I am trying to keep the values in record 1and then move on to record 2. reecord 2 has the same values as in record 1 (the values from the cbo!!!) I am trying to keep the values in record 1 and then go to record 2 and select different values in record 2 from the same cbo. Record 1 and record 2 as well as any other record contain the same values from the cbo.
I am stuck - I am not sure how to rectify this problem so that I can choose different values. The cbo is based on a query from other tables.
Please let me know how to do this as I am still finding this tiresome.
Many thanks.
View 2 Replies
View Related
Oct 31, 2014
If a user wishes to delete a record, rather than deleting the record i'd like to change its status to not current for instance.
The reason being that the information in the records may be useful for statistical use.
I added a yes/no field to the table and then added some code to a delete button to change the yes/no.
I can't seem to hide these records from my forms (using filter) but I could be going the wrong way about it.
View 3 Replies
View Related
Apr 24, 2013
I have built a table off a form that is being used for record keeping and my question is.... This table will be constantly updated with new information so how can I make it to where when new info is added the old info will not be removed or written over?
View 7 Replies
View Related
Jun 12, 2013
I would like to execute a code to remove the duplications in the MS Access Query but keeping one one data of the duplications.
For example, in the below data, I want to check for the data in the column Part No. The part number 123 and 234 are repeated twice so I want to delete the part no 123 and 234 that repeated second time and keeping the one data.
I'm complete new to MS Access.
Part No
Carline
Data
Call
123
BMW
1
1
[Code]...
View 5 Replies
View Related