Quote:
Originally Posted by CHI Brian
Basically if a patient comes in and is seen on 1/3/12 and again on 1/18/12, the weekending date for each should be 1/7/12 and 1/21/12 respectivly.
|
Formulated with other words, this consists in finding the next Saturday from a given date.
This gives us a numeric value (between 1 and 7) corresponding to the day of the week (1 = Sunday, 2 = Monday, ..., 7 = Saturday):
Code:
DatePart("w", SomeDate, vbSunday)
The difference between a given date and the corresponding next Saturday is the day of the week as obtained hereabove minus 7, so:
Code:
Function NextSaturday(ByVal SomeDate As Date) As Date
NextSaturday = DateAdd("d", 7 - DatePart("w", SomeDate, vbSunday), SomeDate)
End Function