UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
2 Pages V < 1 2  (Go to first unread post)
   Reply to this topicStart new topic
> Sum Dates For A Week, Access 2016    
 
   
whitechair
post Oct 13 2017, 07:29 AM
Post#21



Posts: 389
Joined: 26-June 08



Got it! It ended up like this:
CODE
SELECT "By Week" as [Time Period], Count(tblContactHistory.DateAdded) AS CountOfDateAdded, DatePart("yyyy",[DateAdded],2) AS WorkYear, DatePart("ww",[DateAdded],2) & "th Work Week" AS WorkPeriod, [ContactAgent]
FROM tblContactHistory GROUP BY "By Week" , DatePart("yyyy",[DateAdded],2), DatePart("ww",[DateAdded],2), [ContactAgent]
HAVING DatePart("yyyy",[DateAdded],2)=DatePart("yyyy",Date(),2) AND DatePart("ww",[DateAdded],2) =DatePart("ww",Date(),2)

UNION

SELECT "By Month" as [Time Period], Count(tblContactHistory.DateAdded) AS CountOfDateAdded, DatePart("yyyy",[DateAdded],2) AS WorkYear, DatePart("m",[DateAdded],2) & "th Work Month" AS WorkPeriod, [ContactAgent]
FROM tblContactHistory GROUP BY "By Week" , DatePart("yyyy",[DateAdded],2), DatePart("m",[DateAdded],2), [ContactAgent]
HAVING DatePart("yyyy",[DateAdded],2) =DatePart("yyyy",Date(),2) AND DatePart("m",[DateAdded],2) =DatePart("m",Date(),2)


I really appreciate your commitment to this. Thank you!

--------------------
Jeff Moseler
Access 2007
Go to the top of the page
 
GroverParkGeorge
post Oct 13 2017, 07:35 AM
Post#22


UA Admin
Posts: 30,723
Joined: 20-June 02
From: Newcastle, WA


Excellent. I'm glad to hear you worked it out. And you gained a bit more insight into SQL in the bargain.

Continued success with your project.

--------------------
Go to the top of the page
 
2 Pages V < 1 2


Custom Search
RSSSearch   Top   Lo-Fi    18th October 2017 - 11:48 AM