Mcgillivray, Donald [ITS]
donald.a.Mcgillivray at mail.sprint.com
Fri Feb 27 19:13:23 CST 2004
Well, my carriage returns didn't stay put. You probably got the drift, but trying again anyway: Function EndsOfWeek(datInputDate As Date, strWhichEnd As String) As Date Dim datFirstOfWeek As Date, datLastOfWeek As Date datFirstOfWeek = datInputDate - (Weekday(datInputDate) - 1) datLastOfWeek = datInputDate + (7 - Weekday(datInputDate)) Select Case strWhichEnd Case "First" EndsOfWeek = datFirstOfWeek Case "Last" EndsOfWeek = datLastOfWeek End Select End Function -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Mcgillivray, Donald [ITS] Sent: Friday, February 27, 2004 5:03 PM To: Access Developers discussion and problem solving Subject: RE: [AccessD] Getting the start and end dates of the current week Christopher, This ought to do it: Function EndsOfWeek(datInputDate As Date, strWhichEnd As String) As Date Dim datFirstOfWeek As Date, datLastOfWeek As Date datFirstOfWeek = datInputDate - (Weekday(datInputDate) - 1) datLastOfWeek = datInputDate + (7 - Weekday(datInputDate)) Select Case strWhichEnd Case "First" EndsOfWeek = datFirstOfWeek Case "Last" EndsOfWeek = datLastOfWeek End Select End Function Don -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Christopher Hawkins Sent: Friday, February 27, 2004 3:27 PM To: accessd at databaseadvisors.com Subject: [AccessD] Getting the start and end dates of the current week I need a function that will determine the start and end dates of the current week. I'm hacking around with some code, but I'm not producing enything useful. Surely I'm not the first to have this problem? -Christopher- -- _______________________________________________ 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