以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 怎么简化代码? (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=143802) |
-- 作者:31803263 -- 发布时间:2019/12/4 21:15: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("ComboBox2") If .Value IsNot Nothing Then If Filter > "" Then Filter = Filter & " And " End If Filter = 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 & "登记日期>= #" & .Value & "#" End If End With With e.Form.Controls("DateTimePicker2") If .Value IsNot Nothing Then If Filter >"" Then Filter = Filter & " And " End If Filter = Filter & "登记日期<= #" & .Value & "#" End If End With With e.Form.Controls("ComboBox3") If .Value IsNot Nothing Then If Filter > "" Then Filter = Filter & " And " End If Filter = Filter & "摘要 like \'%" & .Value & "%\'" End If End With With e.Form.Controls("ComboBox4") If .Value IsNot Nothing Then If Filter >"" Then Filter = Filter & " And " End If Filter = Filter & "金额= \'" & .Value & "\'" End If End With With e.Form.Controls("ComboBox5") If .Value IsNot Nothing Then If Filter >"" Then Filter = Filter & " And " End If Filter = Filter & "实付= \'" & .Value & "\'" End If End With With e.Form.Controls("ComboBox6") If .Value IsNot Nothing Then If Filter >"" Then Filter = Filter & " And " End If Filter = Filter & "报销人= \'" & .Value & "\'" End If End With With e.Form.Controls("ComboBox7") If .Value IsNot Nothing Then If Filter >"" Then Filter = Filter & " And " End If Filter = Filter & "领款人= \'" & .Value & "\'" End If End With
|
-- 作者:有点蓝 -- 发布时间:2019/12/5 9:25:00 -- 简化不了 |