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

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Find The First And Last Date Using Week Number, Access 2016    
 
   
InfoHound
post Aug 27 2019, 05:08 PM
Post#1



Posts: 1,157
Joined: 1-December 12



Using a query I get the week number using

CODE
format([WDate],"WW")


Let's say I use week 35 I want to find the first and last dates in a table for week # 35.
Can this be done?

Thanks
Go to the top of the page
 
June7
post Aug 27 2019, 05:15 PM
Post#2



Posts: 957
Joined: 25-January 16



Try:

SELECT Max(WDate) AS MaxDate, Min(WDate) AS MinDate FROM table WHERE Format(WDate, "WW") = '35';

or GROUP BY to return all weeks

SELECT Max(WDate) AS MaxDate, Min(WDate) AS MinDate, Format(WDate, "WW") AS Wk FROM table GROUP BY Format(WDate, "WW");
This post has been edited by June7: Aug 27 2019, 05:18 PM

--------------------
Attachments Manager is below the edit post window. To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
DEBUG! DEBUG! DEBUG! http://www.cpearson.com/Excel/DebuggingVBA.aspx
Go to the top of the page
 
InfoHound
post Aug 27 2019, 05:34 PM
Post#3



Posts: 1,157
Joined: 1-December 12



Thank you very much June 7. It works perfect!
Go to the top of the page
 
Jeff B.
post Aug 27 2019, 05:38 PM
Post#4


UtterAccess VIP
Posts: 10,323
Joined: 30-April 10
From: Pacific NorthWet


I didn't notice any handling of the 'year' component of your date. Is your [WDate] an actual date/time data type value?

--------------------
Regards

Jeff Boyce
Microsoft Access MVP (2002-2015)

Mention of hardware or software is, in no way, an endorsement thereof. The FTC of the USA made this disclaimer necessary/possible.
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    12th November 2019 - 03:57 AM