Duplicates in query results

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jmar93
    New Member
    • Mar 2008
    • 46

    #1

    Duplicates in query results

    Hi,

    I'm using Access 2007 and am trying to use a query as a recordsource for a form. The query is bound to a combo box that I will use to select a customer that currently has orders in the database. Many of the customers have multible orders pending so when the query runs it lists each customer once for each open order. How can I make it so it only lists each customer name once regardless of how many orders they have?

    thanks,
    Jeff
  • nspader
    New Member
    • Mar 2008
    • 78

    #2
    Let me make sure I understand this correctly?

    You have a combo box that lists the customers only. These are based on Open orders in the system?

    If this is true then I believe you are going to need to order by customer. This should take out any duplicate customers. If that doesnt work then you will need to put in a criteria to select distinct.

    Hope this helps, I am fairly new to things too but I have similar results.

    Nick

    Comment

    • jmar93
      New Member
      • Mar 2008
      • 46

      #3
      Thanks for your response Nick, but it turns out all I had to do was go into the query properties and change the "Unique Values" property setting to "yes" and the duplicates are gone.

      Thanks again for you response.

      Jeff

      Comment

      • NeoPa
        Recognized Expert Moderator MVP
        • Oct 2006
        • 32669

        #4
        Jeff,

        Nick's suggestion of "SELECT DISTINCT ..." is actually another way of doing exactly that. When you look at the resultant query in SQL view you will see just that (SELECT DISTINCT) at the top.

        Comment

        • Big X
          New Member
          • Apr 2008
          • 42

          #5
          Originally posted by jmar93
          Hi,

          I'm using Access 2007 and am trying to use a query as a recordsource for a form. The query is bound to a combo box that I will use to select a customer that currently has orders in the database. Many of the customers have multible orders pending so when the query runs it lists each customer once for each open order. How can I make it so it only lists each customer name once regardless of how many orders they have?

          thanks,
          Jeff

          Im new to this but have you tried group by customername ?

          worth a quick try but well see what the experts come up with.

          Comment

          • NeoPa
            Recognized Expert Moderator MVP
            • Oct 2006
            • 32669

            #6
            That could work, but is not as efficient a solution as the DISTINCT predicate already found.

            Comment

            Working...