我可以在日期之间进行搜索,但如果我只想从开始日期及以后进行搜索。
在过去的几周里,我一直在尝试自学 VBA 和 SQL……这是一个工作进展。
If Me.tb_dateRange1 <> "" And Me.tb_dateRange2 <> "" Then
Dim LYear As Integer
Dim thisDate As Date
startDate = Me.tb_dateRange1
endDate = Me.tb_dateRange2
LYear = Year(endDate)
If variationNumber = 0 Then
sqlDateRange = " WHERE " & sqlDateRange
Else
sqlDateRange = " AND " & sqlDateRange
End If
'No end date conditions
If endDate <> "" Then
sqlDateRange = sqlDateRange & " Between #" & startDate & "# And #" & endDate & "#"
Else
'thisDate = #12/12/2223#
sqlDateRange = sqlDateRange & " >= #" & startDate & "#"
End If
sqlMiddle = sqlMiddle & sqlDateRange
variationNumber = variationNumber + 1
End If