namliam
04-24-2008, 01:04 AM
I was unable to find a weekstart calculation function, so I made one for this thread
http://www.access-programmers.co.uk/forums/showthread.php?p=697261&posted=1#post697261
Maybe it is an idea to put this function in here as Code Repo?
Function WeekStart(intWeekNR As Integer, intYear As Integer) As Date
Dim dtMondayWk1 As Date
Dim dtJan1st As Date
Dim intWeekday As Integer
dtJan1st = DateSerial(intYear, 1, 1)
intWeekday = vbMonday ' Week startday, use vbSunday for sunday
' Default for "week1"
dtMondayWk1 = dtJan1st - Weekday(dtJan1st, intWeekday) + 1
If Format(dtJan1st, "WW") <> "1" Then
dtMondayWk1 = dtMondayWk1 + 7
End If
WeekStart = dtMondayWk1 + (intWeekNR - 1) * 7
End Function
http://www.access-programmers.co.uk/forums/showthread.php?p=697261&posted=1#post697261
Maybe it is an idea to put this function in here as Code Repo?
Function WeekStart(intWeekNR As Integer, intYear As Integer) As Date
Dim dtMondayWk1 As Date
Dim dtJan1st As Date
Dim intWeekday As Integer
dtJan1st = DateSerial(intYear, 1, 1)
intWeekday = vbMonday ' Week startday, use vbSunday for sunday
' Default for "week1"
dtMondayWk1 = dtJan1st - Weekday(dtJan1st, intWeekday) + 1
If Format(dtJan1st, "WW") <> "1" Then
dtMondayWk1 = dtMondayWk1 + 7
End If
WeekStart = dtMondayWk1 + (intWeekNR - 1) * 7
End Function