If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Due Dates That Fall on Weekend
Can someone please tell me what I need to do to make any due date that falls
on a Saturday or Sunday default back to Friday. I need very specific instructions as I have tried to do this for several years and can not get it to work properly. Thanks Julie |
#2
|
|||
|
|||
Due Dates That Fall on Weekend
For a specific answer, we might need some more details. Is a user
entering a date on a form that needs to be verified at that time? Is the due date being calculated based on a different date? It won't be too hard to do though. You can use the Weekday() function and the DateAdd() function. Post a few more details and we'll help ya out. You can use logic like this: if Weekday([duedate]) = 7 then [duedate] = DateAdd("d", -1, [duedate] elseif Weekday([duedate]) = 1 then [duedate] = DateAdd("d", -2, [duedate] end if |
#3
|
|||
|
|||
Due Dates That Fall on Weekend
An expression like the following should work to calculate the desired date.
IIF(Weekday([SomeDate],2)5,DateAdd("d",5-Weekday([SomeDate],2),[SomeDate]),[SomeDate]) That will work in a query as a calculated field. Elsewhere it may fail if SomeDate is ever null. John Spencer Access MVP 2002-2005, 2007-2010 The Hilltop Institute University of Maryland Baltimore County ghetto_banjo wrote: For a specific answer, we might need some more details. Is a user entering a date on a form that needs to be verified at that time? Is the due date being calculated based on a different date? It won't be too hard to do though. You can use the Weekday() function and the DateAdd() function. Post a few more details and we'll help ya out. You can use logic like this: if Weekday([duedate]) = 7 then [duedate] = DateAdd("d", -1, [duedate] elseif Weekday([duedate]) = 1 then [duedate] = DateAdd("d", -2, [duedate] end if |
Thread Tools | |
Display Modes | |
|
|