DCount query

gmazza76

Well-known Member
Joined
Mar 19, 2011
Messages
767
Office Version
  1. 365
Platform
  1. Windows
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
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
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?
 
Upvote 0
Solution
Thanks, any hint to the significant important part I need to look at/out for
 
Upvote 0
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? :)


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

Forum statistics

Threads
1,214,924
Messages
6,122,294
Members
449,077
Latest member
Rkmenon

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top