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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date and Time Formula

Status
Not open for further replies.

TEM3

Technical User
Dec 6, 2004
324
US
I've created a report that is normally meant to be run at the end of the work day for submissions that occured during the day. However, if the report is run before 15:00 hours (3 pm current time), I would like it to list the submissions for the previous workday. However, if the previous day is a Sunday, of course we have to go back two days to Friday.

If I call my date selection variable ReportDate, how can I do a formula for the above and place it in my report so that it will be not only available for record selection, but will also be part of the Report Title??
 
Try something like this formula:
Code:
if CurrentTime < Time(15, 00, 00) then
  (if DayOfWeek(CurrentDate) = 2 then
     CurrentDate - 2
   else
     CurrentDate - 1)
else
  CurrentDate
You would then use this formula in your selection criteria.

-Dell

A computer only does what you actually told it to do - not what you thought you told it to do.
 
Worked like a charm (after changing the Monday logic to "CurrentDate - 3" to get to Friday). Thanks......
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top