Time query

bnjbone

New member
Local time
Today, 18:25
Joined
Nov 17, 2011
Messages
1
I'm looking for a query that will calculate whether a time is between 10pm and 7am
 
Welcome to the forum.

You can use the following criteria;
Code:
Not Between #23:00# And #07:00#
Counter intuitively you need to use the Not condition, otherwise you will get values between 07:00 and 23:00 hrs.
 
Hi there I have a field which uses ShortTime format and have tried

Code:
Not Between #23:00# And #07:00#

but I get a data type mismatch error?
 
Code:
between '22:00' and '07:00'


hmmm - still getting data type mismatch error if I usethat. I definitely have 'short time' chosen in the format option for the field in the table
 
You have to Format the field too using the Format() function. Remember that the Format property is only for display purposes, it maintains the actual data.

Format([ArriveDate],"Short Time")

Then use one of the criteria provided by JBB or myself.
 
You have to Format the field too using the Format() function. Remember that the Format property is only for display purposes, it maintains the actual data.

Format([ArriveDate],"Short Time")

Then use one of the criteria provided by JBB or myself.


ahaa. in the words of Goldfinger: "well played Mr Bond"
 
This is strange

If i try

Between '18:01' And '07:59'

it doesn't filter those occuring between those hours but it does if I choose

Between '08:00' And '18:00'
 
It does for me. You probably have some other criteria that is further restricting the records.
 
How can Between A and B work, when B<A ?
 
I had other criteria on my first query to look for records between 08:00 and 18:00. All I have done is change time to between 18:01 and 07:59

this should work on a 24 clock principle surely
 
How can Between A and B work, when B<A ?


see where you getting at but A and B is start and end time here and my start time is 6 o clock at night, my end time is 8 in the morning
 
Welcome to the forum.

You can use the following criteria;
Code:
Not Between #23:00# And #07:00#
Counter intuitively you need to use the Not condition, otherwise you will get values between 07:00 and 23:00 hrs.


Just noticed this!!!

lol
 
Okie - I have never used Between in my life, and the thing seems to not care about the relative value of the interval ends, so I eat my words :)

Remeber that your db knows nothing about 24 hour clocks when you deal with strings - so no matter whether you say '08:00' and '18:00' or the other way around, it's the same interval - all times after 08:00 and before 18:00
 
are you sure? all arrivetime entries fall between 18:01 and 07:59 hours?

could you send my a copy of your version?
Positive. See attached image.

I have also attached the db.
 

Attachments

  • BCCluster.zip
    BCCluster.zip
    42.7 KB · Views: 56
  • TimeRange.png
    TimeRange.png
    37.2 KB · Views: 45

Users who are viewing this thread

Back
Top Bottom