# DCount query



## gmazza76

Good afternoon,

I am trying to duplicate a count query into a DCount as I want to show this inside an existing query without having to do a join etc...

Is this possible as when I try the following I get an error in the "HANDELED" part. I am trying to count how many times the AgentID would show on the same date as the CDate field

The error I am getting is "The Microsoft Access database engine cannot find the input table or query 'Handled'. Make sure it exists and that its spelled correctly.



		Code:
__


Call Inbound: DCount([AgentID],[CallReason1])='"Handled"' AND [Call Type])<>'"Check1"' Or [Call Type] = '"Check2"' AND [Peripheral Call Type] = '"Check3"')


SQL Code that works



		Code:
__


SELECT [CDate], [AgentID], Count(BusinessLendingAllCallData.[Agent Peripheral Number]) AS [CountOfAgentID]
FROM Table
WHERE ((([CallReason1])="handled") AND (([CallType])<>"Check1" Or ([Call Type])<>"Check2"))
GROUP BY [CDate], [AgentID], [Call Type]
HAVING ((([Peripheral Call Type])="Check3"));


thanks in advance


----------



## welshgasman

Look up the syntax for Dcount(). You are missing an important part of it. 
I would also surround your different logic with brackets (), as I do not even know how Access will interpret that. I cannot work out how it is meant to work?


----------



## gmazza76

Thanks, any hint to the significant important part I need to look at/out for


----------



## welshgasman

The domain that you are searching on? 

When you do not know the syntax, Google it, don't try and just make it up.  A human might see what you are trying to achieve, but a computer will not. Computers are picky, get one character wrong and they will complain. 
I am suprised the compiler did not complain at all the mistakes in that DCount(), though there are that many, it was probably thoroughly confused as to what was meant to be what? 



			dcount() access - Google Search
		


Also note that all parameters are surrounded by ", which you also left off?


----------

