' 09/19/2008

' returns the starting & ending dates for the current week

'   use in an Access query like this:

'   WHERE MyDate >= Get_StartOfWeek() AND MyDate <= Get_EndOfWeek()

 

Function Get_StartOfWeek() As Date

    Dim d As Date

    d = Date

    Do While DatePart("w", d, vbSunday) > 1

        d = DateAdd("d", -1, d)

    Loop

    Get_StartOfWeek = d

End Function

 

Function Get_EndOfWeek() As Date

    Dim d As Date

    d = Date

    Do While DatePart("w", d, vbSunday) < 7

        d = DateAdd("d", 1, d)

    Loop

    Get_EndOfWeek = d

End Function