unique count

  • Thread starter Thread starter andrew
  • Start date Start date
A

andrew

Hello all!
In a form, i'm using DCount("[ID_Num]","query1") to count
the number of items in a query.

Of course, it does not check for unique ID numbers, and
will return "5" for the below list.

10, 10, 20, 20, 30

How do I set it to count only unique numbers, so it
returns "3"?

Thanks!
Andrew
 
The simplest way would be to modify the query to return only distinct
values. You can to that with the Distinct clause:

SELECT DISTINCT ID_Num FROM SomeTable

If you can't modify the query for some reason, create a second like this:
SELECT DISTINCT ID_Num FROM Query1
and reference that query with the DCount.
--
--Roger Carlson
www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L
 
Back
Top