Last Thursday of previous month

CharlesWilliams

Registered User.
Local time
Today, 14:01
Joined
Dec 7, 2004
Messages
70
Hello Access Experts,

I'm going to ask an easy question. How to get the last Thursday of previous month?

For 5 particular queries I need to pull the date range starting at the last Thursday of the previous month forward.

Any help would be greatly appreciated.

- Charles Williams
 
No question really can be considered an easy question. Here is a function to return the last Thursday of the previous month:

Code:
Function GetTh(dtDate As Date) As Date
Dim LastDate As Date, WeekD As Integer
LastDate = DateSerial(Year(dtDate), Month(dtDate), 0)
WeekD = Weekday(LastDate, vbSunday)
If WeekD = 5 Then
GetTh = LastDate
Else
GetTh = DateAdd("d", -(WeekD - 5), LastDate)
End If
End Function

This is using Sunday as the first day of the week. That could be changed if you have a different system.
 

Users who are viewing this thread

Back
Top Bottom