Date time dilema

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

Guest

I am running into a dilema I posed this problem last week and recieved what I
thought was a great idea how ever either I dont understand or did something
wrong.
The problem - I have a query that under lies a datasheet view of a form. I
need the result of the query to return all of the records from 08:00am to
07:59am the following day. The date is stored in a field strDate, the time in
a field strStime. One solution was to create a calaculated column in the
query "strDate+strStime" then in the criteria section place a Between
Date() +8#8:00AM# And Date()+#7:59AM#+1
This seems to work fine untill after midnite then the query returns nothing
unless I change the +1 to a -1 then it will return the records

Thank you all for the help so far
 
I believe I am the person who gave you this expression. So, here is a
slightly modified expression:

Between Date() + #8:00 AM# + IIf(Time(Now())<#8:00 AM#, -1, 0) And Date() +
#7:59 AM# + 1 + IIf(Time(Now())<#8:00 AM#, -1, 0)
 
Ken,
Thank you so much for your help!!! I copied the below expression and pasted
it in the criteria and wounldn't you know Access yelled back at me with the
following.... The expression you entered has a function containing the wrong
number of arguments. I am lost as to which way to go now Thanks again for
your help you have been very patient with me.
 
Sorry -- been working with too many different programming languages
lately...

Between Date() + #8:00 AM# + IIf(TimeValue(Now())<#8:00 AM#, -1, 0) And
Date() +
#7:59 AM# + 1 + IIf(TimeValue(Now())<#8:00 AM#, -1, 0)

--

Ken Snell
<MS ACCESS MVP>
 
Back
Top