我需要一个公式,找出两个给定日期之间的出发日期,其中出发发生的时间晚于给定时间

时间:2016-02-08 12:53:24

标签: ms-access expression formula

我正在使用Access 365 2016.

我需要一个公式,找出两个给定日期之间的出发日期,其中出发时间晚于给定时间。

我尝试过这个公式,但它不起作用:

Between [date1] And [date2] Where (TimeValue([Date1] > 09:30

谢谢

上面引用的公式是一种更简单的方法来编写引用表单控件的公式。

下面的公式引用了我的航班表单中的控件,并且是我在表达式构建器中使用的确切公式。

Between [Forms]![Flights]![cboDeparture]

    And

    [Forms]![Flights]![cboDeparture2]

    And

    TimeValue([Forms]![Flights]![cboDeparture])>[Forms]![Flights]![cboGreaterThanTime])

我根据Gustav在评论部分提供的代码更改了公式,但两个代码都没有工作。看评论。 这是我用于方法1:

的代码
    (Between [Forms]![Flights]![cboDeparture] 
And [Forms]![Flights]![cboDeparture2]) 
And (TimeValue([Forms]![Flights]![cboDeparture])>[Forms]![Flights]![cboGreaterThanTi‌​me])

这是我用于方法2:

的代码
    Between (DateValue([Forms]![Flights]![cboDeparture])+#09:30:00#) 
And [Forms]![Flights]![cboDeparture2]

1 个答案:

答案 0 :(得分:0)

尝试:

(Between [Date1] And [Date2]) And (TimeValue([Date1]) > #09:30#)

或:

Between (DateValue([Date1]) + #09:30#) And [Date2]

使用组合框可能:

Between DateValue([Forms]![Flights]![cboDeparture]) And DateValue([Forms]![Flights]![cboDeparture2])
And
TimeValue([Forms]![Flights]![cboDeparture]) > TimeValue([Forms]![Flights]![cboGreaterThanTime])