|
|

What is the next/previous Monday?
Two functions here, one to return the date of the next named day, and the other the previous named day:
Function fDateDayPrevious(dtmDate As Date, bytDaySought As Byte) As Date
If bytDaySought - WeekDay(dtmDate) <= 0 Then
fDateDayPrevious = dtmDate + bytDaySought - WeekDay(dtmDate)
Else
fDateDayPrevious = dtmDate + bytDaySought - WeekDay(dtmDate) - 7
End If
End Function
Function fDateDayAfter(dtmDate As Date, bytDaySought As Byte) As Date
If bytDaySought - WeekDay(dtmDate) >= 0 Then
fDateDayAfter = dtmDate + bytDaySought - WeekDay(dtmDate)
Else
fDateDayAfter = dtmDate + bytDaySought - WeekDay(dtmDate) + 7
End If
End Function |
Top
HOME |
NEW |
TABLES |
QUERIES |
FORMS |
REPORTS |
GENERAL |
API |
DOWNLOADS |
TUTORIAL |
RESOURCES
E-MAIL
Copyright & Disclaimer
|
| |