Gustav Brock
Gustav at cactus.dk
Wed Jan 18 10:57:15 CST 2006
Hi John Busy multitasking week ..? Anyway, here are the functions we use: Public Function DateWeekFirst( _ ByVal datDate As Date, _ Optional ByVal lngFirstDayOfWeek As Long = vbMonday) _ As Date ' Returns the first date of the week of datDate. ' lngFirstDayOfWeek defines the first weekday of the week. ' 2000-09-07. Cactus Data ApS. ' No special error handling. On Error Resume Next ' Validate lngFirstDayOfWeek. Select Case lngFirstDayOfWeek Case _ vbMonday, _ vbTuesday, _ vbWednesday, _ vbThursday, _ vbFriday, _ vbSaturday, _ vbSunday, _ vbUseSystemDayOfWeek Case Else lngFirstDayOfWeek = vbMonday End Select DateWeekFirst = DateAdd("d", vbSunday - WeekDay(datDate, lngFirstDayOfWeek), datDate) End Function Public Function DateWeekLast( _ ByVal datDate As Date, _ Optional ByVal lngFirstDayOfWeek As Long = vbMonday) _ As Date ' Returns the last date of the week of datDate. ' lngFirstDayOfWeek defines the first weekday of the week. ' 2000-09-07. Cactus Data ApS. ' No special error handling. On Error Resume Next ' Validate lngFirstDayOfWeek. Select Case lngFirstDayOfWeek Case _ vbMonday, _ vbTuesday, _ vbWednesday, _ vbThursday, _ vbFriday, _ vbSaturday, _ vbSunday, _ vbUseSystemDayOfWeek Case Else lngFirstDayOfWeek = vbMonday End Select DateWeekLast = DateAdd("d", vbSaturday - WeekDay(datDate, lngFirstDayOfWeek), datDate) End Function /gustav >>> jwcolby at ColbyConsulting.com 18-01-2006 17:40:00 >>> Does anyone have these functions? John W. Colby www.ColbyConsulting.com