Time() based query

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a make table query in which I want data from the previous day before
0900 but from the current day after 0900. I have tried using
IIf(Time()<0.375,<Date() AND >Date()-1, >Date()) in the criteria field, but
I get no results. Either of the date references i.e.(>Date()) alone pulls the
correct days' data, and using the time split with other true/false qualifiers
in other columns pulls the desired results. I just can't get the time split
IIf statement to work with pulling the desired day's data. Any suggestions?
 
Mac

Assuming you have a field that holds date/time data, it sounds like you want
to select the row if the date is yesterday (with the time before 0900), or
if the date is today (with the time after 0900).

"Yesterday, before 0900" might be (Date()-1) + .375 (I haven't check the
syntax). "Today, after 0900" might be Date() + .375 -- check the syntax on
these first, then use them as selection criteria on your date/time field in
your query.

Good luck!

Jeff Boyce
Microsoft Office/Access MVP
 
Thanks for the reply. I have a column that records the date/time flights
happen throughout the day. What I am trying to do is if it is before 9 am on
a certain day, pull the data from yesterday. If it is after 9 am, I need to
pull the current day's data. I can get the two criteria to work separately,
but not together. It just returns no records.
 
Mac: I'm sure I saw a response to you (either in this newsgroup or in
another one) telling you that you cannot put the < and > operators into the
IIf statement like that. (I think it was from Van Dinh). Did you not
understand his reply?
 
New to posting, I could not find the other post, so I reposted here
requesting notifications. I will go look for it again. I have used those
operators in other columns in IIf statements and was able to pull data from
those areas, it's just not working in this Time/Date column. Thank you
 
Back
Top