Solved

Access Query

Posted on 2013-10-23
4
234 Views
Last Modified: 2013-10-23
Hi guys

I am trying to get Month to date sum from two tables and cal efficiency its giving an error
That expression is not include as  a part of aggregate  function.

SELECT SETTLEMENT.[SDate], SETTLEMENT.[RepName], Sum(SETTLEMENT.[Hours Work]) AS [SumOfHours Work], Sum(SETTLEMENT.[Swift]) AS SumOfSwift, Sum(SETTLEMENT.[Phone Calls]) AS [SumOfPhone Calls], Sum(SETTLEMENT.[Meetings]) AS SumOfMeetings, Sum(SETTLEMENT.[Training]) AS SumOfTraining, Sum(SETTLEMENT.[Compliance]) AS SumOfCompliance, Sum(SETTLEMENT.[QA]) AS SumOfQA, Sum(SETTLEMENT.[Oracle Input]) AS [SumOfOracle Input], Sum(SETTLEMENT.[Bank Input]) AS [SumOfBank Input], Sum(SETTLEMENT.[Bank Auth]) AS [SumOfBank Auth], Sum(SETTLEMENT.[Insurances]) AS SumOfInsurances, Sum(SETTLEMENT.[Other]) AS SumOfOther, Sum(SettDPCAT.NewSettled) AS NS, Sum(SettDPCAT.NewHeld) AS NH, Sum(SettDPCAT.HeldSettled) AS HS, Sum(SettDPCAT.HeldReHeld) AS HRH, Sum((([Hours Work])*86400)) AS TH, ((([NS]*1200+[NH]*1500+[HS]*300+[HRH]*300+[S]*90+[Phone Calls]*120+[Meetings]*1800+[Training]*1800+[Compliance]*1800+[QA]*1800+[Oracle Input]*90+[Bank Input]*120+[Bank Auth]*60+[Insurances]*90+[Other]*1800)/([TH]))) AS Efficiency
FROM SettDPCAT INNER JOIN SETTLEMENT ON (SettDPCAT.RepName = SETTLEMENT.RepName) AND (SettDPCAT.[Today Date] = SETTLEMENT.SDate)
GROUP BY SETTLEMENT.[SDate], SETTLEMENT.[RepName]
HAVING (((SETTLEMENT.[SDate]) Between [sd] And [ed]));

Open in new window

0
Comment
Question by:surah79
  • 3
4 Comments
 
LVL 26

Accepted Solution

by:
jerryb30 earned 500 total points
Comment Utility
Maybe:
SELECT SETTLEMENT.[SDate], SETTLEMENT.[RepName], Sum(SETTLEMENT.[Hours Work]) AS [SumOfHours Work], Sum(SETTLEMENT.[Swift]) AS SumOfSwift, Sum(SETTLEMENT.[Phone Calls]) AS [SumOfPhone Calls], Sum(SETTLEMENT.[Meetings]) AS SumOfMeetings, Sum(SETTLEMENT.[Training]) AS SumOfTraining, Sum(SETTLEMENT.[Compliance]) AS SumOfCompliance, Sum(SETTLEMENT.[QA]) AS SumOfQA, Sum(SETTLEMENT.[Oracle Input]) AS [SumOfOracle Input], Sum(SETTLEMENT.[Bank Input]) AS [SumOfBank Input], Sum(SETTLEMENT.[Bank Auth]) AS [SumOfBank Auth], Sum(SETTLEMENT.[Insurances]) AS SumOfInsurances, Sum(SETTLEMENT.[Other]) AS SumOfOther, Sum(SettDPCAT.NewSettled) AS NS, Sum(SettDPCAT.NewHeld) AS NH, Sum(SettDPCAT.HeldSettled) AS HS, Sum(SettDPCAT.HeldReHeld) AS HRH, Sum((([Hours Work])*86400)) AS TH, ((([NS]*1200+[NH]*1500+[HS]*300+[HRH]*300+[S]*90+[Phone Calls]*120+[Meetings]*1800+[Training]*1800+[Compliance]*1800+[QA]*1800+[Oracle Input]*90+[Bank Input]*120+[Bank Auth]*60+[Insurances]*90+[Other]*1800)/([TH]))) AS Efficiency
FROM SettDPCAT INNER JOIN SETTLEMENT ON (SettDPCAT.RepName = SETTLEMENT.RepName) AND (SettDPCAT.[Today Date] = SETTLEMENT.SDate)
GROUP BY SETTLEMENT.[SDate], SETTLEMENT.[RepName],(([NS]*1200+[NH]*1500+[HS]*300+[HRH]*300+[S]*90+[Phone Calls]*120+[Meetings]*1800+[Training]*1800+[Compliance]*1800+[QA]*1800+[Oracle Input]*90+[Bank Input]*120+[Bank Auth]*60+[Insurances]*90+[Other]*1800)/([TH])))
HAVING (((SETTLEMENT.[SDate]) Between [sd] And [ed]));

Open in new window

0
 
LVL 26

Expert Comment

by:jerryb30
Comment Utility
Can you post a small (sanitized) sample, with your query? And desired results? If this is with linked tables, you'll have to spoof things by importing necessary tables/data.
0
 

Author Closing Comment

by:surah79
Comment Utility
Thanks a lot
0
 
LVL 26

Expert Comment

by:jerryb30
Comment Utility
Just curious. Why the B?
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now