How do I count this?

Novaember

Registered User.
Local time
Today, 05:03
Joined
Nov 3, 2009
Messages
33
Hello
Having trouble <again>
I have columns like [Fruit], [Drink] etc
I have a query that runs that says for example this:

IIF([Fruit]="Apple",1,0)+IIF([Drink]="MTDew",1,0)

With other criteria I end up with
4 records that meet all my criteria and there is 1 record where Apple is present and one record where MTDew is present so I have two rows that return one field each a 1.

Now.. I want to count how many "items" there are. That is counting how many "1"s (How many Apple and how many MTDew) there are.

I know it is some kind of count function but everything I try returns 4 (because I have 4 records that meet my criteria) but I want it to return 2 because I only have 2 "Item"s.

I've tried the following which might be stupid but were the only things I could think of.

Count(IIF([Fruit]="Apple",1,0)+IIF([Drink]="MTDew",1,0)) - this returns 4
DCount(IIF([Fruit]="Apple",1,0)+IIF([Drink]="MTDew",1,0)) - this returns nothing because it gives me an error.

So any help would be greatly appreciated.
Thanks in advance
<clueless>
 
Ya know..everytime I post something here..

I have been trying to figure this out for HOURS.. then I post a question.. then walk to my mailbox and the answer HITS ME
NEVERMIND!!! I figured it out!
DUH
SUM(IIF([Fruit]="Apple",1,0)+IIF([Drink]="MTDew",1,0)) - returns 2
/dance
 

Users who are viewing this thread

Back
Top Bottom