以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  [求助]老师帮忙改下关于OR的代码  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=66313)

--  作者:huangfanzi
--  发布时间:2015/4/3 10:11:00
--  [求助]老师帮忙改下关于OR的代码
Dim JH As WinForm.CheckedComboBox = e.Form.Controls("CheckedComboBox_卷号")

Filter = "工序 in (\'" & GX.Text.replace(",", "\',\'") & "\') And 牌号 In (\'" & PH.Text.replace(",", "\',\'") & "\')  And 卷号 In (\'" & JH.Text.replace(",", "\',\'") & "\')  And 起始时间  >= #" & dt1.Value & "# And 起始时间 < #" & dt2.Value.AddDays(1) & "# And 厚度 >=" & hd1.Value & " And 厚度 <=" & hd2.Value & "And 宽度 >=" & kd1.Value & " And 宽度 <=" & kd2.Value 

上面的筛选字符串中,打底色部分我要加个or,希望实现以下功能:
当我不是下拉选择,而是在CheckedComboBox的输入框中录入卷号时,能进行模糊匹配,也就是我只要录入卷号的中间一部分就行了,谢谢!

--  作者:有点甜
--  发布时间:2015/4/3 10:15:00
--  

Dim JH As WinForm.CheckedComboBox\' = e.Form.Controls("CheckedComboBox_卷号")

 

Dim temp As String = "1=2"
For Each s As String In jh.text.Split(",")
    temp = temp & " or 卷号 like \'%" & s & "%\'"
Next

temp = "(" & temp & ")"
msgbox(temp)

 

Filter = "工序 in (\'" & GX.Text.replace(",", "\',\'") & "\') And 牌号 In (\'" & PH.Text.replace(",", "\',\'") & "\')  And " & temp & " And 起始时间  >= #" & dt1.Value & "# And 起始时间 < #" & dt2.Value.AddDays(1) & "# And 厚度 >=" & hd1.Value & " And 厚度 <=" & hd2.Value & "And 宽度 >=" & kd1.Value & " And 宽度 <=" & kd2.Value