Is it possible to set criteria for a query that would make it go to the current date except for the hours of midnight to 6am go to the previous date?
Query Criteria
Collapse
X
-
Becker,
If you use:
you will get the decimal part of the Date/Time generated by Now().Code:Now() - Date()
The "Time" portion of a date is actually expressed in a decimal in the system. 12:00 Midnight = 0.00000; 12:00 Noon = 0.50000. Thus, the hours between Midnight and 6 Am would be <= 0.25.
So, what you want to evaluate your date/time to be is somewhat similar to this:
Hope this hepps!Code:WHERE [Your Date/Time Field] = IIf(Now()-Date()<=0.25,Date()-1,Date())Comment
-
This is a simpler way of getting to the time-only portion of Now().Code:TimeValue(Now())
Thus, the simplest and most straightforward way of returning the date specified would be :Code:Date() == DateValue(Now())
This reflects going back six hours from the current time and taking the date part of that value.Code:DateValue(DateAdd("h",-6,Now()))Comment
-
You know, I maybe psychic, but I'd guessed that already :-DOriginally posted by TwinnyFoTwinnyFo:
I didn't know they existed...
Of course you're welcome. Sharing knowledge with those I know will pass it on is always even more pleasing and rewarding.Comment
Comment