两个小时范围之间的访问(ADO)查询 [英] Access (ADO) query between two hour ranges
问题描述
使用VB通过ADODB查询访问.mdb数据库.
Using VB to query an access .mdb database via ADODB.
我的日期列同时包含日期和时间,我想建立一个查询来忽略日期,而只引用该列中的时间,这样,我就可以返回包含以下内容的记录:他们的时间介于用户指定的范围内,而忽略日期.
My date column holds both date and time, I would like to to build a query which will ignore the date, and refer only to the time in that column, in such a way, that will enable me to return records that have their time in between a range given by the user, ignoring the date.
我尝试在数字之间进行选择,但我相信访问权限我做错了
I tried selecting between numbers, but I believe access I'm doing it wrong
...WHERE [Date_Time_Of_Birth] Between #04:00:00# and #06:00:00#
只是不能按预期工作...在这里需要指导.
Just doesn't work as intended ... need a direction here.
推荐答案
Use the TimeValue Function to ignore the date portion of your Date_Time_Of_Birth values.
#04:00:00#和#06:00:00#分别是凌晨4点和6点.由于您需要PM时间,因此请按照以下示例之一编写值:
Also #04:00:00# and #06:00:00# are 4 and 6 AM. Since you want PM times, write the values as in one of these examples:
WHERE TimeValue([Date_Time_Of_Birth]) Between #16:00:00# and #18:00:00#
WHERE TimeValue([Date_Time_Of_Birth]) Between #4 PM# and #6 PM#
这篇关于两个小时范围之间的访问(ADO)查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!