以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  筛选异常  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=131663)

--  作者:有点甜
--  发布时间:2019/3/4 9:56:00
--  
Dim Filter As String = "1=1"
With e.Form.Controls("客户编码1")
    If .Value IsNot Nothing Then
        Filter &= " and 客户编码 = \'" & .Value & "\'"
    End If
End With
With e.Form.Controls("成品编码1")
    If .Value IsNot Nothing Then
        Filter &= " and 成品编码 = \'" & .Value & "\'"
    End If
End With
With e.Form.Controls("材料描述1")
    If .Value IsNot Nothing Then
        Filter = Filter & " and 材料描述 like \'%" & .Value & "%\'"
    End If
End With
With e.Form.Controls("材料编码1")
    If .Value IsNot Nothing Then
        Filter &= " and 材料编码 = \'" & .Value & "\'"
    End If
End With
With e.Form.Controls("成品描述1")
    If .Value IsNot Nothing Then
        Filter = Filter & " and 成品描述 like \'%" & .Value & "%\'"
    End If
End With
With e.Form.Controls("开始日期1")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "要求交货日期>= \'" & .Value & "\'"
    End If
End With
With e.Form.Controls("结束日期1")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "要求交货日期 <= \'" & .Value & "\'"
    End If
End With
With e.Form.Controls("业务员1")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "业务员= \'"  & .Value & "\'"
    End If
End With
With e.Form.Controls("销售订单号1")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "销售订单号 = \'"  & .Value & "\'"
    End If
End With
msgbox(filter)
e.Form.controls("发货明细").Table.DataTable.LoadPage = 0
e.Form.controls("发货明细").Table.DataTable.LoadFilter = "[发货状态] = \'进行中\' and " & filter
e.Form.controls("发货明细").Table.DataTable.Load
DataTables("包装箱出库_发货明细").DataCols("材料编码").RaiseDataColChanged()
DataTables("包装箱出库_发货明细").DataCols("已包未发").RaiseDataColChanged()
DataTables("包装箱出库_发货明细").DataCols("需求数量").RaiseDataColChanged()
[此贴子已经被作者于2019/3/4 9:56:55编辑过]