> Using the function datepart I can return a week number given any date.
What I now want to do is return a date (say monday) given a week
number. How can I do this?
Try this "air code" function which should be copied to a standard module (a
global module, not a module behind a form or report):
'*********CODE START
Public Function GetDateByYearWeekNumWeekDay(iYear As Integer, _
iWeekNum As Integer, iWeekDayNum As Integer) As Date
Dim vdate As Date
vdate = DateSerial(iYear, 1, 1) + ((iWeekNum - 1) * 7)
GetDateByYearWeekNumWeekDay = DateValue(vdate - Weekday(vdate) + iWeekDayNum)
End Function
'*********CODE END
Usage:
MyDate = GetDateByYearWeekNumWeekDay(2004,12,vbThursday)
Which returns:
3/18/2004 (Thursday in the 12th week of this year)
--
Bruce M. Thompson, Microsoft Access MVP
bt******@mvps.org (See the Access FAQ at
http://www.mvps.org/access)
NO Email Please. Keep all communications
within the newsgroups so that all might benefit.<<