以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 我这个代码应该怎么改比较好? (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=65700) |
-- 作者:布莱克朱 -- 发布时间:2015/3/20 17:59:00 -- 我这个代码应该怎么改比较好? Dim Filter As String ="" Dim T As String = e.Form.Controls("关键字").Value For Each dc As Col In Tables(Args(1)).Cols \'遍历表的所有列 If dc.DataCol.IsDate OrElse dc.DataCol.IsBoolean OrElse dc.DataCol.IsNumeric Then \'如果是时间列,逻辑列,数值列 Continue For \'排除 End If If Filter > "" Then Filter = Filter & " Or " End If Filter = Filter & "[" & dc.Name & "] Like \'%" & T & "%\'" \'根据控件值迷糊筛选 Next With e.Form.Controls("开始日期") If .Value IsNot Nothing Then If Filter >"" Then Filter = Filter & " And " End If Filter = Filter & "采购日期 >= \'" & .Value & "\'" End If End With With e.Form.Controls("结束日期") If .Value IsNot Nothing Then If Filter >"" Then Filter = Filter & " And " End If Filter = Filter & "采购日期 <= \'" & .Value & "\'" End If End With If Filter > "" Then 我想找出日期段内的关键字 现在还是会出现不是我设定的日期段的数据
|
-- 作者:有点甜 -- 发布时间:2015/3/20 18:26:00 -- 和日期连接的时候,先把filter 加上括号,不然 or 连接符就影响了
If filter > "" then filter = "(" & filter & ")" |
-- 作者:布莱克朱 -- 发布时间:2015/3/20 18:53:00 -- 明白 我试试 |