title: MS Access 03 - Query Expression to Add like ID Numbers
body: <p>So I have a query that is a Top Nth aggregate query, and I have another query built from that one that returns all the offices/locations grouped for each of the top sales. I want to make a report that counts the number of offices associated with each of these top Nth ID values that are returned in this query. I want to use a domain aggregate expression in text boxes on the report so that I do not have to spend time each month looking up those IDs to determine what needs to go into the expression.</p>
  
  <p>So is there an expression I can add to the second query that will assign a number descending number to the IDs?</p>
  
  <p>The first query looks like:   /</p>
  
  <pre><code>ID#    ITEM             Sold  /
  765    Lawnmowers        75  /
  764    Weed trimmers     64  /
  etc
  </code></pre>
  
  <p>the second query looks like:   /</p>
  
  <pre><code>ID#    ITEM             Sold         Location   /
   /
  765    Lawnmowers        75          New York  /
  765    Lawnmowers        75          Maryland  /
  765    Lawnmowers        75          Ohio     /
  765    Lawnmowers        75          Virginia   /
  764    Weed trimmers     64          Florida
  764    Weed trimmers     64          north Carolina   /
  </code></pre>
  
  <p>I need:
  /</p>
  
  <pre><code>ID#    ITEM             Sold         Location          IDGroup#   /
  
  765    Lawnmowers        75          New York                 1   /
  765    Lawnmowers        75          Maryland                 1   /
  765    Lawnmowers        75          Ohio                     1   / 
  765    Lawnmowers        75          Virginia                 1   /
  764    Weed trimmers     64          Florida                  2   /
  764    Weed trimmers     64          north Carolina           2   /
  </code></pre>
  
  <p>please help. thanks! i am pulling my hair on this one!</p>
  
  <p>what i am trying to do is be able to report the number of items sold (done), how many locations sold the item (need dynamically) for a given time period.</p>
  
  <p>i was trying to use an DCount expression but if I use the Product ID, it does me no good because these figures change monthly (this is all based from a Top Ten query to begin with)</p>
  
  <p>i know i confuse myself with this question  :)</p>