Query to show Orders for next upcoming Sunday

VegMan

New member
Local time
Today, 11:01
Joined
Nov 19, 2018
Messages
6
Hello,

I am looking to create a query that can show all orders for the next upcoming Sunday and not by date.

Is there a way of doing this ? I can filter by date no problem but I want it to be by day and only the next upcoming Sunday not previous ones.

Thanks,
 
Try

DateAdd("d", -Weekday(Date) + 8, Date)
 
there is also a generic formula for next sunday, next Monday, next Tuesday, next …:
Code:
Public Function FindNextDOW(dte As Date, whatDay As VbDayOfWeek) As Date
   FindNextDOW = dte + 7 - Weekday(dte + 7 - whatDay)
   If FindNextDOW = dte Then FindNextDOW = FindNextDOW + 7
End Function
debug.print FindNextDOW(Date, vbSunday) --> next sunday date
debug.print FindNextDOW(Date, vbWednesday) --> next Wednesday date
 

Users who are viewing this thread

Back
Top Bottom