Take user date and show date of first day of week

mrssevans

Registered User.
Local time
Today, 22:43
Joined
Nov 15, 2001
Messages
190
I have a report that the user specifies the date, but at the top of the report I would like to display the first day of the week that the user specified. So if the user chose 9/2/03 the label on the top of the report would show 9/1/03 because that was the first day of the week. Is this possible?
 
I´m not very good at reports, but for the date calculation stuff, maybe you can use the week() and/or weekday() functions?

Fuga.
 
Function StartOfWeek(d As Variant, Optional FirstWeekday As Integer) As Variant
'
' Returns the date representing the first day of the current week.
'
' Arguments:
' D = Date
' FirstWeekday = (Optional argument) Integer that represents the first
' day of the week (e.g., 1=Sun..7=Sat).
'
If IsMissing(FirstWeekday) Then 'Sunday is the assumed first day of week.
StartOfWeek = d - WeekDay(d) + 1
Else
StartOfWeek = d - WeekDay(d, FirstWeekday) + 1
End If
End Function
 
Thank you so much for the quick reply.
Is there any way to show the actual date of that first day of the week?
 

Users who are viewing this thread

Back
Top Bottom