Hi
Does anyone no how to identify the Fridays date from a inputted date.
i.e DateSorted FridayDate
21-Oct-02 25-Oct-02
23-Oct-02 25-Oct-02
Thanks in advance................
Check this out.
http://www.access-programmers.co.uk/forums/showthread.php?threadid=36737
Fuga.
raskew
10-29-2002, 02:31 AM
You could try:
Function NextNDay(ByVal pDay As Date, wday As Integer) As Date
NextNDay = [pDay] - WeekDay([pDay]) + wday + IIf(WeekDay([pDay]) >= wday, 7, 0)
End Function
...which you can call from the debug window with:
? nextnday(#10/21/02#, vbFriday)
10/25/02
To go in the opposite direction, try:
Function LastNDay(pDay As Date, wday As Integer) As Date
LastNDay = [pDay] - (WeekDay([pDay]) + IIf(WeekDay([pDay]) <= wday, 7, 0) - wday)
End Function
...which would return the previous specified day, e.g.
? lastnday(#10/21/02#, vbFriday)
10/18/02