[AccessD] First/last day of week

Hale, Jim Jim.Hale at FleetPride.com
Wed Jan 18 13:58:54 CST 2006


A date range selector class? Now that sounds cool.
Jim

-----Original Message-----
From: John Colby [mailto:jwcolby at colbyconsulting.com]
Sent: Wednesday, January 18, 2006 11:56 AM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] First/last day of week


>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

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

***********************************************************************
The information transmitted is intended solely for the individual or
entity to which it is addressed and may contain confidential and/or
privileged material. Any review, retransmission, dissemination or
other use of or taking action in reliance upon this information by
persons or entities other than the intended recipient is prohibited.
If you have received this email in error please contact the sender and
delete the material from any computer. As a recipient of this email,
you are responsible for screening its contents and the contents of any
attachments for the presence of viruses. No liability is accepted for
any damages caused by any virus transmitted by this email.


More information about the AccessD mailing list