Dcount for multiple criteria

janith

CPA
Local time
Today, 13:18
Joined
Apr 11, 2012
Messages
65
Hi,

Hope some one can help me with the dcount formula for a text box on form. I want to count the number of items pending or left blank for a particular queue for the user.

User is fosusername()
Table is tblmain
Fields are queues, status.

The formula should count for that user from that table for that particular queue (ccbr) the status is " pending " or "blank". Blank here means there is no record.

Please help....
 
That link is for dlook up.
 
First line in the link:

Note that the same logic applies to most Domain Aggregate Functions (DMax, DMin etc.)
 
Criteria for all the domain aggregate function will follow the same rules.
 
How about if the field is null and I want to count that as well.. I can enter " pending " but what about a null field?
 
Try

"...AND FieldName Is Null"
 
For status here I'm using [status] = "pending" or [status] IsNull
Still getting #error... Please advise
 
It would help if you posted your actual formula. Inside the quotes of the criteria, you'd have to use single quotes around pending, and there's a space between Is and Null. There's a different function named IsNull(), but the usage would be different.
 
I'm still getting the #error in the field... posting the control source formula ..please advise what's missing.

=DCount("adviserall","tblmain","[queue type] ='MSCCBR' and [status] = 'Pending' or Is Null)

I'm sure there might be comma error somewhere, please guide..
 
=DCount("adviserall","tblmain","[queue type] ='MSCCBR' and [status] = 'Pending' or [status] & '' = ''")
 
Code:
"[queue type] ='MSCCBR' and [status] = 'Pending' or [status] & '' = ''"

When mixing ANDs and ORs you need to use parenthisis.

I believe the above criteria will always evaluate to True when the [status] field is Null, no matter the [queue type] value.
 
I'm not sure plog... Are you suggesting to make changes to the last part of the formula?!! Ie; with regards to null value..
 
(Criteria1 AND Criteria2) OR Criteria3
If Criteria3 is true no other parts matter--the whole thing will be true.


Criteria1 AND (Criteria2 OR Criteria3)
If Criteria3 is true, Criteria1 still matters, in fact it determines what the whole thing evaluates to.

Remember 6th grade math and order of operations (https://en.wikipedia.org/wiki/Order_of_operations)? That's exactly what this is. Parenthesis then ANDs/ORs
 
Well I still get a zero value with the above formula... Please help out
 
Well if they is no other way to fix this I guess will have to use two controls to show count for pending and blank records!!!
 

Users who are viewing this thread

Back
Top Bottom