Dim Filter As String
With RibbonTabs("运次借款").Groups("查询区").Items("车牌号")
If .text > "" Then
Filter = "车牌号 like '%" & .text & "%'"
End If
End With
With RibbonTabs("运次借款").Groups("查询区").Items("借款单号")
If .text > "" Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "借款单号 like '%" & .text & "%'"
End If
End With
With RibbonTabs("运次借款").Groups("查询区").Items("调度单号")
If .text > "" Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "调度单号 like '%" & .text & "%'"
End If
End With
With RibbonTabs("运次借款").Groups("查询区").Items("借自")
If .value <> Nothing Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "操作时间 >= #" & .value & "#"
End If
End With
With RibbonTabs("运次借款").Groups("查询区").Items("借至")
If .value <> Nothing Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "操作时间 <= #" & .value & "#"
End If
End With
If Filter > "" Then
Tables("运次借款").DataTable.loadfilter = Filter
Tables("运次借款").DataTable.load
Else
Tables("运次借款").DataTable.loadfilter = ""
Tables("运次借款").DataTable.load
End If
老师,以上是我提问后按您指导改写后的代码,其他都没问题,只是操作时间在查询时有个问题:比如,列内有个时期是2019-12-10,我在菜单查询这个时间段时,两个输入框分别填入2019-12-09和2019-12-11可出结果,但如果都填入2019-12-10则查询为空,不知为什么?请指导一下
测试的那个不存在这个问题
[此贴子已经被作者于2020/2/6 19:37:20编辑过]