Brad Marks
BradM at blackforestltd.com
Thu Aug 9 16:31:17 CDT 2012
David, Thanks for the help. The code works great. Brad ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of David McAfee Sent: Thursday, August 09, 2012 4:17 PM To: Access Developers discussion and problem solving Subject: Re: [AccessD] Need to derive the "Start" and "End" dates from a "DatePart Week Number" Sorry, 2012 was hard coded while testing. It should be: ?(CDate("01/01/" & YEAR(Date())) - WeekDay("01/01/" & YEAR(Date()), vbMonday) )+7 * (DatePart("ww",Date())) Now it work Next year too :P On Thu, Aug 9, 2012 at 2:04 PM, David McAfee <davidmcafee at gmail.com> wrote: > If Weekday starts on Sunday (which I assume it does as per your datepart > example below) > > Week Starting: (CDate("01/01/" & 2012) - WeekDay("01/01/" & 2012, > vbMonday))+7 * (DatePart("ww",WeekNumber)) > > Can test in debug window: > ?(CDate("01/01/" & 2012) - WeekDay("01/01/" & 2012, vbMonday))+7 * > (DatePart("ww",Date())) > > > HTH > David McAfee > > > > > On Thu, Aug 9, 2012 at 1:43 PM, Brad Marks <BradM at blackforestltd.com>wrote: > >> All, >> >> I have a small report that summarizes the number of new orders by week. >> The report's underlying query uses "DatePart" like this. >> >> >> OrderWeek: DatePart("ww",[OrderDate]) >> >> >> >> Here is a small sample of what the report looks like. >> >> ~~~~~~~~~~~~ >> Week Nbr-of-Orders >> 16 333 >> 17 355 >> ~~~~~~~~~~~~~ >> >> I have been asked to spell out what the start and end dates are for each >> week number on the report. >> >> Is it possible to derive the "Start" and "End" dates from a week number? >> >> Thanks, >> Brad >> >> -- >> AccessD mailing list >> AccessD at databaseadvisors.com >> http://databaseadvisors.com/mailman/listinfo/accessd >> Website: http://www.databaseadvisors.com >> > > -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.