Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Week Ending Date

Status
Not open for further replies.

threadgills

Technical User
May 29, 2003
34
0
0
US
I have a form with an unbound field that I want to use as an "End Date." This "End Date" will always be on a Sunday. I'ved tried just about every date function there is but because the system date changes, my "End Date" does also. I need it to stay on the following Sunday's date for an entire week without changing.

Any help is appreciated.
 
Have you tried something like this ?
DateAdd("d", 8 - Weekday(Date()), Date())

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
string,
this will give you dates between the preceeding Monday through Friday. It does change on Tuesday to the present week. Put this in the criteria field of the date field. you could play around with it to compute Sunday.

Between IIf(Weekday(Date())=2,DateAdd("d",2-Weekday(Date()),Date())-8,DateAdd("d",2-Weekday(Date()),Date())) And IIf(Weekday(Date())=2,DateAdd("d",2-Weekday(Date()),Date())-3,Date())

I also have a function for a textbox to list the date from the previous Moday;
Function prevweek(ByVal mynumber As Date) As Date

prevweek = IIf(WeekDay(DATE) = 2, DateAdd("d", 3 - WeekDay(DATE), DATE) - 7, DateAdd("d", 2 - WeekDay(DATE), DATE))

End Function

To change day to Sunday, change the blue number to 1
To get an end date, like friday, it would be

=[the name of the textbox with the function] + 4

Hope this helps.
jim

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top