Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2004
    Posts
    2

    Unanswered: Displaying Duplicates on Form

    I am trying to display 2-4 records at one time that all have the same data in a field.

    I already have ran a find duplicate query and have that info looking like I want it in my table.
    Example of my table:

    Field1 Field2 Field3
    4321 George Miller
    4321 Ken Johnson
    4321 Alex Jordan
    1234 Bob Jones
    1234 Nancy Smith

    I have, next, created my form to include these fields in bound textboxes. I can easily pull up one record at a time...no problem.

    What I want to do is display all records with the same number in Field1.

    Example of my form:

    Field1Label: 4321
    Field2Label: George Field3Label: Miller
    Field2Label: Ken Field3Label: Johnson
    Field2Label: Alex Field3Label: Jordan
    Field2Label: Field3Label:

    Then, I want to hit the "Next" button on my form and a SQL statement or VB code would pick out the next group of Field1 Duplicates and display them.
    Example:

    Field1Label: 1234
    Field2Label: Bob Field3Label: Jones
    Field2Label: Nancy Field3Label: Smith
    Field2Label: Field3Label:
    Field2Label: Field3Label:

    Thanks for the help!
    Charles

  2. #2
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    add a list myList (or a combo if your prefer) somewhere on your form
    .rowsource is
    SELECT DISTINCT Field1 FROM yourDuplicatesQuery ORDER BY Field1;


    Private sub myList_AfterUpdate()
    me.recordsource = "SELECT * FROM theOriginalTableHavingDuplicates WHERE Field1 = " & myList & ";"
    end sub

    izy
    currently using SS 2008R2

  3. #3
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    oooops, you probably need to requery!

    Private sub myList_AfterUpdate()
    me.recordsource = "SELECT * FROM theOriginalTableHavingDuplicates WHERE Field1 = " & myList & ";"
    me.requery
    end sub
    currently using SS 2008R2

  4. #4
    Join Date
    Oct 2004
    Posts
    2
    Thanks for the help. I am moving in the right dirction, but now I am getting

    'Runtime Error 2001': You Cancelled the Previous Operation.

    What should I do next?

    Thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •