根据传递特定日期的另一个日期字段更新文本字段的值

Update a text Field's value based on another date field passing a certain date

对于我的 Access 数据库,我有一个包含两个字段的单一 table - 奖励状态和建议截止日期。我希望在建议的截止日期过后,奖励状态更改为 "Pending"。

目前,我正在编写 VBA 以在满足条件后更新字段。

Function AwardUpdate()

    Dim rstInput As DAO.Recordset
    Set rstInput = CurrentDb.OpenRecordset("TestInput")

    With rstInput
        Do Until .EOF
            .Edit
            If .Fields(19) < Date And .Fields(29) = "Pre-Submission" Then
                .Fields(29) = "Pending"
                .MoveNext
            Else
                .MoveNext
            End If
        Loop
    End With

End Function

但我似乎无法获得检查建议截止日期是否早于当前日期的标准。

有没有更好的方法来完成这个?

这应该有效 - 只在需要的地方编辑:

   Do Until .EOF
       If .Fields(19).Value < Date And .Fields(29).Value = "Pre-Submission" Then
           .Edit
               .Fields(29).Value = "Pending"
           .Update
       End If
       .MoveNext
   Loop