If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Aggregate count function
I've created a query that counts the number of records based on a criteria of Yes or No (for a Yes/No data type). Is there any way to have the results display a zero (or something) when there are no Yeses or Nos?
CM -- Message posted via http://www.accessmonster.com |
#2
|
|||
|
|||
I guess I am missing something here. How can you have zero yes and zero no in a
recordset? A yes/no field has to have one value or the other. Are you applying some criteria and therefore returning zero records in the recordset? "Chris Motherwell via AccessMonster.com" wrote: I've created a query that counts the number of records based on a criteria of Yes or No (for a Yes/No data type). Is there any way to have the results display a zero (or something) when there are no Yeses or Nos? CM -- Message posted via http://www.accessmonster.com |
#3
|
|||
|
|||
Thanks for the reply John.
Let's say the criteria is Yes for a Yes/No field. If there are no Yeses in the the data, is it possible to display a zero to show this result? CM -- Message posted via http://www.accessmonster.com |
#4
|
|||
|
|||
Can you post the query you are using? Or are you using one of the VBA aggregate
functions? A very basic query might look like: SELECT Sum(IIF(SomeYN=True,1,0)) as CountYes, Sum(IIF(SomeYN=False,1,0)) as CountNo, Sum(IIF(SomeYN2=True,1,0)) as CountYes2, Sum(IIF(SomeYN2=False,1,0)) as CountNo2, FROM SomeTable "Chris Motherwell via AccessMonster.com" wrote: Thanks for the reply John. Let's say the criteria is Yes for a Yes/No field. If there are no Yeses in the the data, is it possible to display a zero to show this result? CM -- Message posted via http://www.accessmonster.com |
#5
|
|||
|
|||
I had to nest the queries to get it to work - the Sum and Iif combined did the trick! Thanks a lot
Chris -- Message posted via http://www.accessmonster.com |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Max Function on Count | jk | Running & Setting Up Queries | 1 | October 22nd, 2004 03:34 AM |
Count function show zero when no record for an institution | George in Waco | General Discussion | 1 | October 12th, 2004 03:25 PM |
Which function to use to count the records satisfying two criteria? | Max | Worksheet Functions | 0 | November 21st, 2003 07:59 AM |
Count function | Worksheet Functions | 2 | November 20th, 2003 07:16 PM |