[AccessD] First/last day of week

John Colby jwcolby at ColbyConsulting.com
Wed Jan 18 11:56:03 CST 2006


>Busy multitasking week ..?

OMG, you can't believe! I am to the point where I am using Outlook to
schedule blocks of my time for specific client tasks.  0800-1700 filled with
1/2 hr lunch and then 2100-midnight as well.  And that for the next couple
of weeks, and possibly beyond.

Thanks for the functions.  I integrated them into my Date Range selector
class and now have a "This week" selection.

John W. Colby
www.ColbyConsulting.com 


-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Gustav Brock
Sent: Wednesday, January 18, 2006 11:57 AM
To: accessd at databaseadvisors.com
Subject: Re: [AccessD] First/last day of week

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 


--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list