以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 查询表 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=162912) |
-- 作者:采菊东篱下 -- 发布时间:2021/4/17 10:10:00 -- 查询表 Dim Filter As String With e.Form.Controls("ComboBox1") If .Value IsNot Nothing Then Filter = "分类 = \'" & .Value & "\'" End If End With With e.Form.Controls("DateTimePicker1") If .Value IsNot Nothing Then If Filter > "" Then Filter = Filter & " And " End If Filter = Filter & "Month(日期) = \'" & Month(.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 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 DataTables("车辆缴费情况查询_Table1") If Filter > "" Then LockBaseMainForm() \'锁定主界面 .StopRedraw() For i As Integer = .DataRows.count - 1 To 0 Step -1 .DataRows(i).Delete Next .LoadFilter = Filter .LoadOrder = "日期" .Load() .ResumeRedraw() UnLockBaseMainForm() \'解锁主界面 End If End With
|
-- 作者:有点蓝 -- 发布时间:2021/4/17 10:32:00 -- 去掉下面代码,重新加载会自动移除之前的数据,不需要多此一举,数据都删除了,还显示什么! For i As Integer = .DataRows.count - 1 To 0 Step -1 .DataRows(i).Delete Next 如果不做分页,下面也去掉,根本没有用 .LoadOrder = "日期"
|
-- 作者:采菊东篱下 -- 发布时间:2021/4/17 11:01:00 -- 安日期排序啊,数据源是分页加载的。 |
-- 作者:有点蓝 -- 发布时间:2021/4/17 11:18:00 -- LoadOrder是用来在分页取数据的时候排序的,需要配合LoadPage使用,不是用来给界面排序的。麻烦有空多看看理解帮助文档 [此贴子已经被作者于2021/4/17 11:18:44编辑过]
|
-- 作者:采菊东篱下 -- 发布时间:2021/4/17 11:20:00 -- 比如已经加载过一次,又重选条件,再点查询按钮就要把已经加载的数据清除,改为这样还是不行: Dim Filter As String With e.Form.Controls("ComboBox1") If .Value IsNot Nothing Then Filter = "分类 = \'" & .Value & "\'" End If End With With e.Form.Controls("DateTimePicker1") If .Value IsNot Nothing Then If Filter > "" Then Filter = Filter & " And " End If Filter = Filter & "Month(日期) = \'" & Month(.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 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 DataTables("车辆缴费情况查询_Table1") If Filter > "" Then If DataTables.Contains("车辆缴费情况查询_Table1") = False Then For i As Integer = .DataRows.count - 1 To 0 Step -1 .DataRows(i).Delete Next Else LockBaseMainForm() \'锁定主界面 .StopRedraw() .LoadFilter = Filter .LoadOrder = "日期" .Load() .ResumeRedraw() UnLockBaseMainForm() \'解锁主界面 End If End If End With |
-- 作者:有点蓝 -- 发布时间:2021/4/17 11:26:00 -- With DataTables("车辆缴费情况查询_Table1") LockBaseMainForm() \'锁定主界面 .StopRedraw() .LoadFilter = Filter .Load() .ResumeRedraw() UnLockBaseMainForm() \'解锁主界面 End With
|
-- 作者:采菊东篱下 -- 发布时间:2021/4/17 12:08:00 -- 不行,还是没数据显示。 |
-- 作者:有点蓝 -- 发布时间:2021/4/17 13:42:00 -- 说明没有符合条件的数据: msgbox(Filter)
|
-- 作者:采菊东篱下 -- 发布时间:2021/4/19 17:09:00 -- 月租和临时停放在缴费情况表中分开在不同的列显示,现在我想做一个查询表 With e.Form.Controls("ComboBox1") If .Value = e.Form.Controls("ComboBox1").Items(0) 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(1) Dim Filter1 As String Filter1 = "分类 = \'" & .Value & "\'" With e.Form.Controls("StartDate") If .Value IsNot Nothing Then If Filter1 >"" Then Filter1 = Filter1 & " And " End If Filter1 = Filter1 & "缴费_临时停放_起计时间 >= #" & .Value & "#" End If End With With e.Form.Controls("EndDate") 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 With DataTables("安所属日期查询_Table1") If Filter1 > "" Then LockBaseMainForm() \'锁定主界面 .StopRedraw() .LoadFilter = Filter1 .Load() .ResumeRedraw() UnLockBaseMainForm() \'解锁主界面 End If End With End If End With |
-- 作者:有点蓝 -- 发布时间:2021/4/19 17:21:00 -- 没有符合条件的数据 msgbox(Filter1)
|