Date() + 1 hour?

  • Thread starter Thread starter Harmannus
  • Start date Start date
H

Harmannus

Hallo,

I have a report based on a query with criteria set to date() - see below -
that shows totals based on the current day. But the day ends on 1 o'clock of
the next day (1 hour past midnight). Is it possible to show the report of
the day before if selected on 1 o'clock at night?

It should not effect the possibility to print this report on te current day.

So closing on 1 o'clock on october 24 and printing a report based on october
23.

I now have a selection critaria in my query: Accountdate=date()

Thanx for any tips!

Regards,
Harmannus
 
Date() will show you today's date with no time: in other words, midnight
this morning. To get midnight tomorrow morning, add 1 to the date. Then, use
DateAdd to add one hour to that:

DateAdd("h", 1, Date()+1)
 
If I understand you correctly, you want your report to include records from
the current day or the previous day if you run it between midnight and 1 AM.
In other words, records created between midnight and 1 AM will be part of
the curent day but running the report durin that hour will let you show
records from the previous day only.

If that assumption is correct than couldn't you just test for the hour of
the day and return either the current date or yesterday's date depending on
the result?

Accountdate = IIf(Hour(Now())<1,Date()-1,Date())

The IIf statement will return the current date anytime after 1 AM or
yesterday's date anytime before 1 AM.
 
Back
Top