' For this code you put in a date in Text37
' It will output first week day last week in Text 32 and last work day last week in Text 35
Dim firstDayofWeek As Date
Dim lastDayofWeek As Date
Dim temp2 As Date
temp2 = Me.Text37.Value ' This is just my test textbox to test few dates
' Check for first day of week counting holidays
firstDayofWeek = DateAdd("ww", -1, temp2 - Weekday(temp2) + 1)
Do While Weekday(firstDayofWeek, vbMonday) > 6
firstDayofWeek = firstDayofWeek + 1
Loop
' Check holiday table
Do While IsNull(DLookup("[HolidayDate]", "tblHolidays", "[HolidayDate] = #" & Format(firstDayofWeek, "mm\/dd\/yyyy") & "#")) = False
firstDayofWeek = firstDayofWeek + 1
Loop
Me.Text32.Value = firstDayofWeek
' Check for last day of week counting holidays
lastDayofWeek = DateAdd("ww", -1, temp2 - Weekday(temp2) + 6)
Do While Weekday(lastDayofWeek, vbMonday) > 6
lastDayofWeek = lastDayofWeek + 1
Loop
' Check holiday table
Do While IsNull(DLookup("[HolidayDate]", "tblHolidays", "[HolidayDate] = #" & Format(lastDayofWeek, "mm\/dd\/yyyy") & "#")) = False
lastDayofWeek = lastDayofWeek + 1
Loop
Me.Text35.Value = lastDayofWeek