很不明白,为什么红色标注的日期这样写找不到符合条件的数据,起计日期改为小于,止计日期改为大于就出现数据,而下面的起计时间、止计时间这样写没问题。
With e.Form.Controls("ComboBox1")
If .Value = e.Form.Controls("ComboBox1").Items(1)
Dim Filter As String
Filter = "分类 = '" & .Value & "'"
With e.Form.Controls("StartDate")
If .Value IsNot Nothing Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "缴费_月租_起计日期 >= #" & .Value & "#"
End If
End With
With e.Form.Controls("EndDate")
If .Value IsNot Nothing Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "缴费_月租_止计日期 >= #" & .Value & "#"
End If
End With
With e.Form.Controls("DropBox1")
If .Value IsNot Nothing Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "车牌号码 = '" & .Value & "'"
End If
End With
With DataTables("安所属日期查询_Table1")
If Filter > "" Then
LockBaseMainForm() '锁定主界面
.StopRedraw()
.LoadFilter = Filter
.Load()
.ResumeRedraw()
UnLockBaseMainForm() '解锁主界面
End If
End With
ElseIf .Value = e.Form.Controls("ComboBox1").Items(2)
Dim Filter1 As String
Filter1 = "分类 = '" & .Value & "'"
With e.Form.Controls("DateTimePicker1")
If .Value IsNot Nothing Then
If Filter1 > "" Then
Filter1 = Filter1 & " And "
End If
Filter1 = Filter1 & "缴费_临时停放_起计时间 >= #" & .Value & "#"
End If
End With
With e.Form.Controls("DateTimePicker2")
If .Value IsNot Nothing Then
If Filter1 > "" Then
Filter1 = Filter1 & " And "
End If
Filter1 = Filter1 & "缴费_临时停放_止计时间 <= #" & .Value & "#"
End If
End With
With e.Form.Controls("DropBox1")
If .Value IsNot Nothing Then
If Filter1 > "" Then
Filter1 = Filter1 & " And "
End If
Filter1 = Filter1 & "车牌号码 = '" & .Value & "'"
End If
End With
Messagebox.show(Filter1)
With DataTables("安所属日期查询_Table1")
If Filter1 > "" Then
LockBaseMainForm() '锁定主界面
.StopRedraw()
.LoadFilter = Filter1
.Load()
.ResumeRedraw()
UnLockBaseMainForm() '解锁主界面
End If
End With
End If
End With