Hi Rick
The following function will return the last day of the week containing a
given date:
Public Function EndOfWeek(ByVal GivenDate As Variant, _
Optional FirstDayOfWeek As Integer = vbUseSystemDayOfWeek, _
Optional IncludeTime As Boolean _
) As Variant
On Error Resume Next
If Not IsDate(GivenDate) Then GivenDate = CDate(GivenDate)
If Err = 0 Then
EndOfWeek = DateValue(GivenDate) - WeekDay(GivenDate, FirstDayOfWeek) + 7
If IncludeTime Then EndOfWeek = DateAdd("s", -1, EndOfWeek + 1)
End If
End Function
It takes three arguments:
GivenDate: any recognisable date format
FirstDayOfWeek: a number 1 (Sunday) through 7 (Saturday) which specifies
which day is to be considered the *first* day of the week. If not
specified, it assumes the system setting (defaults to Sunday)
IncludeTime: if false or not specified, returns just the date, or if
true returns the date *and* time one second before midnight on that date.
For your purpose you can paste the code above into a standard module, and
set the recordsource of your textbox to:
=EndOfWeek(Date(), 7)