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


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

主题:筛选查询

帅哥哟,离线,有人找我吗?
admin22327
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:172 积分:2010 威望:0 精华:0 注册:2017/12/20 8:56:00
筛选查询  发帖心情 Post By:2019/7/4 23:54:00 [只看该作者]

Dim Filter As String
'With e.Form.Controls("cmbProduct")
   ' If .Value IsNot Nothing Then
    '    Filter = "供应商名称 = '" & .Value & "'"
   ' End If
'End With

With e.Form.Controls("StartDate")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "日期 >= #" & .Value & "#"
    End If
End With
With e.Form.Controls("EndDate")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "日期 <= #" & .Value & "#"
    End If
End With

If e.Form.Controls("rdoYifu").Checked = True ' 如果付款状态选择了"已付"
    If Filter >"" Then
        Filter = Filter & " And "
    End If
    Filter = Filter & "已付款 = True"
End If
If e.Form.Controls("rdoWeifu").Checked = True ' 如果付款状态选择了"未付"
    If Filter >"" Then
        Filter = Filter & " And "
    End If
    Filter = Filter & "已付款 = False Or 已付款 Is Null"
End If
If Filter > "" Then
    Tables("采购汇总表_Table1").Filter = Filter
End If
Tables("采购汇总表_Table1").Cols("金额").GrandTotal = True '合计
Tables("采购汇总表_Table1").GrandTotal = True

在这个查询的基础上继续使用下面代码筛选,怎么可以组合起来
Dim txt As String = e.Form.Controls("TextBox2").Text
Dim tbl As Table =  Tables("采购汇总表_Table1")
If txt = "" Then
    tbl.Filter = ""
Else
    txt = "'%" & txt & "%'"
    tbl.Filter =  "货品名称 Like " & txt & " Or 仓库 Like " & txt  & " Or 规格 Like " & txt   & " Or 供应商名称 Like " & txt  & " Or 条形码 Like " & txt 
End If

 回到顶部
帅哥,在线噢!
有点蓝
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:107680 积分:547721 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2019/7/5 10:09:00 [只看该作者]

tbl.Filter = IIF(tbl.Filter > "",tbl.Filter & " and ","") &  "(货品名称 Like " & txt & " Or 仓库 Like " & txt  & " Or 规格 Like " & txt   & " Or 供应商名称 Like " & txt  & " Or 条形码 Like " & txt & ")"

 回到顶部