以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 下面的代码筛选时当“外协领料_领料日期1”为空时,不生效。哪位老师看看代码应该怎么改? (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=132248) |
-- 作者:1669607010 -- 发布时间:2019/3/18 9:27:00 -- 下面的代码筛选时当“外协领料_领料日期1”为空时,不生效。哪位老师看看代码应该怎么改? With Tables("外协加工纱线明细") Dim Filter As String If .Current IsNot Nothing Then If Filter >"" Then Filter = Filter & " And " End If Filter = Filter & "操作日期 = \'" & .Current("外协领料_领料日期1") & "\' " End If If .Current IsNot Nothing Then If Filter >"" Then Filter = Filter & " And " End If Filter = Filter & "原料用途 = \'" & .Current("纱线名称") & "\'" End If If Filter > "" Then Tables("外协纺纱领料记录_Table1").Filter = Filter End If EndWith [此贴子已经被作者于2019/3/18 9:28:24编辑过]
|
-- 作者:有点甜 -- 发布时间:2019/3/18 12:21:00 -- With Tables("外协加工纱线明细") Dim Filter As String = "1=1" If .Current("外协领料_领料日期1") = Nothing Then Filter = Filter & " and 操作日期 is null " Else Filter = Filter & " and 操作日期 = \'" & .Current("外协领料_领料日期1") & "\' " End If If .Current("纱线名称") = Nothing Then Filter = Filter & " and 原料用途 is null" Else Filter = Filter & " and 原料用途 = \'" & .Current("纱线名称") & "\'" End If If Filter > "" Then Tables("外协纺纱领料记录_Table1").Filter = Filter End If End With |
-- 作者:1669607010 -- 发布时间:2019/3/18 13:10:00 -- 谢谢老师指导 |