DCount with multiple createris

janith

CPA
Local time
Today, 06:12
Joined
Apr 11, 2012
Messages
65
Hi,

Hope someone can help me with this problem. I've a DCount formula on a control source its purpose is to count number of records for a particular user logged on that system and the status field showing as "TBW" for them.

here's the formula:

=DCOUNT ("Status", "tblmain", "Citrix Ids = "&' [Forms]![qrymaintable]![npname]' And "[status] = 'TBW'")

for some reason its counting the total records in the table 'tblmain' and not based on the creteria status = 'TBW'

fyi...I'm using the =fosusername() to capture user ids which is stored on the text control 'npname'.

status is my field name , tblmain is the table name , citrix ids is the field name which has a list of ids

Any help to resolve this issue is highly appreciated....

thank you
 
I don't see how that doesn't cause an error. I would expect . . .
Code:
"CitrixIds = '" & [Forms]![qrymaintable]![npname] & "' And Status = 'TBW'"
. . . or you might need [Citrix Ids] as the field name.

Hope this helps,
 
Thank you will try that.. Hopefully should work..
 
=DCOUNT ("*", "tblmain", "[Citrix Ids] = '" & [Forms]![qrymaintable]![npname] & "' And [status] = 'TBW'")
 
Thank again arnelgp.. Will let know the outcome
 
Tried all the options.. Still can't make it work... It still shows all records.. Any other suggestions??
 
how about using the function straight to your query:

=DCOUNT ("*", "tblmain", "[Citrix Ids] = '" & fosUserName() & "' And [status] = 'TBW'")
 
Suggest building a query in the query builder that gives you the answer you want and then use the where part of the sql you end up with in your DCount.
 
Thanks for getting back so quickly... Surely will try out and let know
 
Still not working.. Not sure what might be the problem
 
So what have you tried - post the code...
 
don't tell me that you also have an apostrophe on your field value!
 
what datatypes are fields:
citrixid and status

nevermind, obviously its text.
 
Last edited:
what datatypes are fields:
citrixid and status

I don't think knowing that is going to help. From the very beginning when the OP should have been getting an error she was getting the count for all of the records. I don't think we'll ever determine what's wrong here by focusing on this DCount. I believe at this point we need to see the database or the part of it that has this problem.
 
janith Could you copy your whole code snippet in
Code:
 [/ CODE] braces for us please? =]
 

Users who are viewing this thread

Back
Top Bottom