Results 1 to 6 of 6
  1. #1
    puppy26 is offline Novice
    Windows Vista Access 2010 32bit
    Join Date
    Jun 2013
    Posts
    7

    Deleting Duplication but keeping original

    Hi all,


    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.

    Please do help me. I'm complete new to MS Access.

    Many thanks!
    Part No Carline Data Call
    123 BMW 1 1
    123 Astra 2 2
    234 Opel 3 4
    235 Volks 4 6
    234 Santro 5 8

  2. #2
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    do you have a primary key in your table to help you indicate which one is the 'first' record? Without a primary key or a date to indicate which one is the correct 'first' record you're going to have some difficulty determining which one to delete.

  3. #3
    puppy26 is offline Novice
    Windows Vista Access 2010 32bit
    Join Date
    Jun 2013
    Posts
    7
    Hi,
    How can I set primary key to a Query or Do I need to set primary key in the table before creating query?

  4. #4
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    Adding a primary key after the fact is not going to help you. The main point is you've showed a dataset with four data fields, how are you using those fields to determine which record should be deleted, is it the 'data' column? is it the 'call' column? is it alphabetical by car type?

  5. #5
    puppy26 is offline Novice
    Windows Vista Access 2010 32bit
    Join Date
    Jun 2013
    Posts
    7
    Quote Originally Posted by rpeare View Post
    Adding a primary key after the fact is not going to help you. The main point is you've showed a dataset with four data fields, how are you using those fields to determine which record should be deleted, is it the 'data' column? is it the 'call' column? is it alphabetical by car type?


    Well, to say exactly. I don't mind which data is being deleted in that column. I want to see only one part number out of those duplications. Hope I have answered your question.

    Many thanks!

  6. #6
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    After re-reading this post I have another question, are you trying to delete data from your TABLE or are you just trying to show an unduplicated list of PARTNO in a QUERY and keep the data in your table.

    In other words, given your example let's assume that's data in a table called tblTest, do you want to physically remove the Astra and Santro records?

    Or are you looking to create a query that will show

    123
    234
    235

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 07-25-2012, 01:01 PM
  2. Query Duplication
    By Lois in forum Queries
    Replies: 1
    Last Post: 11-22-2011, 08:47 AM
  3. duplication problem
    By pdcc in forum Reports
    Replies: 1
    Last Post: 07-16-2011, 09:57 AM
  4. Replies: 11
    Last Post: 12-14-2010, 01:25 PM
  5. duplication
    By noidea in forum Access
    Replies: 1
    Last Post: 07-31-2009, 06:22 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums