I have a database and I am trying to tell it that the workweek for calculating payroll is Sunday through Saturday.
I wrote the code below, but it won't calculate RT when the week starts over, it just keeps going as if the week didn't end.
Function GetWeekStartDate(DateWorked As Date) As Date
GetWeekStartDate = DateAdd("d", DatePart("w", DateWorked, vbSunday), DateWorked)
End Function
Function GetWeekEndDate(DateWorked As Date) As Date
GetWeekEndDate = DateAdd("d", 6, GetWeekStartDate(DateWorked))
End Function
Thanks in advance for any help.
Bailey11
I wrote the code below, but it won't calculate RT when the week starts over, it just keeps going as if the week didn't end.
Function GetWeekStartDate(DateWorked As Date) As Date
GetWeekStartDate = DateAdd("d", DatePart("w", DateWorked, vbSunday), DateWorked)
End Function
Function GetWeekEndDate(DateWorked As Date) As Date
GetWeekEndDate = DateAdd("d", 6, GetWeekStartDate(DateWorked))
End Function
Thanks in advance for any help.
Bailey11