Conditional Dcount and Check Boxes

JackD

Registered User.
Local time
Today, 21:15
Joined
Sep 11, 2008
Messages
20
Hi all,

I'm trying to get a Dcount function to work based on whether 2 check boxes are ticked.

The data table is called tblquestions

The condition of the count is based on [businessservices] AND [vs_chair] being checked.

My stab at it was...

=IIf([tblquestions].[businessServices]=-1,Sum([tblquestions].[vs_chair]=-1))

which i set as the control of 1 text box.

but that flat doesn't work.

Any advice?

Cheers,

Jack
 
Note that the IIF syntax requires three arguments which are all always evaluated...
Code:
IIF(condition, truepart, falsepart)
That they are always evaluated means that even if condition is true, falsepart will still be evaluated. This makes nested and complicated IIF() statements relatively inefficient.

And are you wanting to run...
1) a count only when two fields are true on the current record, or
2) a count of all records in the table where two fields are true.

1) =IIF(me.bool1 And me.bool2, DCount("*", "tblQuestions"), 0)
2) =DCount("*", "tblQuestions", "bool1 and bool2")

It's not clear to me from your post which of these two, if either, are what you're going for.
 

Users who are viewing this thread

Back
Top Bottom