Bobby Heid 
      bheid at sc.rr.com
      
      Mon Jan 15 12:19:53 CST 2007
    
What if you had DteFirstDayOfWeek add 4 days with dateadd to the date
calculated in DteFirstDayOfWeek to come up with the date of last day of the
week?
Bobby
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of JWColby
Sent: Monday, January 15, 2007 12:58 PM
To: 'Access Developers discussion and problem solving'
Subject: [AccessD] First / last day of week
Has anyone got more efficient code than the following?
 
Function DteFirstDayOfWeek(dte As Date) As Date
Dim intDOW As Integer
    intDOW = Weekday(date, vbUseSystemDayOfWeek)
    DteFirstDayOfWeek = date - (intDOW - 1)
End Function
Function DteLastDayOfWeek(dte As Date) As Date
Dim intDOW As Integer
    intDOW = Weekday(date, vbUseSystemDayOfWeek)
    DteLastDayOfWeek = date + (7 - intDOW)
End Function
 
John W. Colby
Colby Consulting
www.ColbyConsulting.com
 
-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com