Foxtable(狐表)用户栏目专家坐堂 → LoadFilter查询


  共有3621人关注过本帖树形打印复制链接

主题:LoadFilter查询

美女呀,离线,留言给我吧!
nuoyan89
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:二尾狐 帖子:503 积分:3495 威望:0 精华:0 注册:2020/10/9 8:45:00
LoadFilter查询  发帖心情 Post By:2023/1/29 14:15:00 [只看该作者]

老师,红色部分是我写的条件,但是加班申请还是会查询出来,如图

If Filter >"" Then
    e.Form.controls("操作工工时").Table.DataTable.LoadPage = 0
    e.Form.controls("操作工工时").Table.DataTable.LoadFilter = "([杂工种类] <> '加班申请' or [杂工种类] <> '调休申请'or [杂工种类] <> '事假申请')  And " & IIf(filter > "", filter, "1=1")
    e.Form.controls("操作工工时").Table.DataTable.Load
End If
整个代码:
Dim Filter As String
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 & "成品描述 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 & "工作内容描述 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
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("工作日期2")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "工作日期  <= '" & .Value & "'"
    End If
End With
If Filter >"" Then
    e.Form.controls("操作工工时").Table.DataTable.LoadPage = 0
    e.Form.controls("操作工工时").Table.DataTable.LoadFilter = "([杂工种类] <> '加班申请' or [杂工种类] <> '调休申请'or [杂工种类] <> '事假申请')  And " & IIf(filter > "", filter, "1=1")
    e.Form.controls("操作工工时").Table.DataTable.Load
End If
Tables("操作工工时明细_操作工工时").Sort = "工作日期 DESC"
DataTables("操作工工时明细_操作工工时").DataCols("计算标准").RaiseDataColChanged()

图片点击可在新窗口打开查看此主题相关图片如下:1.jpg
图片点击可在新窗口打开查看



 回到顶部
帅哥哟,离线,有人找我吗?
有点蓝
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:110574 积分:562760 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2023/1/29 14:25:00 [只看该作者]

不等于的判断一般要使用and
e.Form.controls("操作工工时").Table.DataTable.LoadFilter = "([杂工种类] <> '加班申请' and [杂工种类] <> '调休申请' and  [杂工种类] <> '事假申请')  And " & IIf(filter > "", filter, "1=1")

或者

e.Form.controls("操作工工时").Table.DataTable.LoadFilter = "[杂工种类] not in ('加班申请','调休申请', '事假申请')  And " & IIf(filter > "", filter, "1=1")

 回到顶部