FredixBlog


Just my log about anything I could find enjoyable.



WeekMonday()

author Posted by: fredometro on date Jan 1st, 2004 | filed Filed under: MS-Access

Retrieves the date of the monday of a given week. You need the WeekDay() function to make this one work.
Public Function WeekMonday(TheYear As Integer, TheWeek As Integer)
Dim tmpWeek, tmpYear As Integer
Dim tmpDate As Date
      tmpDate = DateSerial(TheYear, 6, 30)
      While WeekDay(tmpDate, vbMonday) <> 1
            tmpDate = DateAdd(”d”, -1, tmpDate)
      Wend
      While WeekNumber(tmpDate) < TheWeek
            tmpDate = DateAdd(”d”, 7, tmpDate)
      Wend
      While WeekNumber(tmpDate) > TheWeek And DateSerial(Year(tmpDate), 1, 1) = DateSerial(TheYear, 1, 1)
            tmpDate = DateAdd(”d”, -7, tmpDate)
      Wend
      WeekMonday = tmpDate ‘DateAdd(”d”, -7, tmpDate)
End Function

tag19 Responses to “WeekMonday()”

  1. unfollughen Said,

    jobs and medical transcription http://pharmacyrxworld.info/item/diclofenac.html?lng=uk&cv=po san jose medical group north jackson

  2. terPeriatix Said,

    foreign bank supervision enhancement act http://legalrxdrugstore.com/articles.php?articleId=20&cv=us parathyroid calcium

     Add A Comment

You must be logged in to post a comment.