Foxtable(狐表)用户栏目专家坐堂 → 筛选的问题?


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

主题:筛选的问题?

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


加好友 发短信
等级:九尾狐 帖子:2552 积分:20045 威望:0 精华:0 注册:2012/5/19 11:57:00
筛选的问题?  发帖心情 Post By:2014/11/20 22:07:00 [只看该作者]


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

如上图 筛选代码 如下

 要求 如下:已审 未审 所有,这个所有 是指符合全面的条件 ,不知道怎么写

Dim Filter As String
With e.Form.Controls("pmname")
    If .Value IsNot Nothing Then
        Filter = "产品名称 = '" & .Value & "'"
    End If
End With

With e.Form.Controls("ckname")
    If .Value IsNot Nothing Then
        Filter = "仓库 = '" & .Value & "'"
    End If
End With
With e.Form.Controls("khname")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If
        Filter = 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("rdo1").Checked = True
    If Filter >"" Then
        Filter = Filter & " And "
    End If
    Filter = Filter & "单据状态='已审核'"
End If
If e.Form.Controls("rdo2").Checked = True
    If Filter >"" Then
        Filter = Filter & " And "
    End If
    Filter = Filter & "单据状态<>'已审核' or 单据状态 is null"
End If
If Filter > "" Then
    Tables("销售单明细").Filter = Filter
End If
If Tables("销售单明细").rows.count=0
Tables("销售单明细").GrandTotal = False
Else
Tables("销售单明细").Cols("匹数").GrandTotal = True
Tables("销售单明细").Cols("米数").GrandTotal = True
Tables("销售单明细").GrandTotal = True '显示合计模式
End If


 


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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2014/11/20 22:11:00 [只看该作者]

 所有是不用写的。

 

Dim Filter As String = "1=1"
With e.Form.Controls("pmname")
    If .Value IsNot Nothing Then
        Filter = " and 产品名称 = '" & .Value & "'"
    End If
End With

With e.Form.Controls("ckname")
    If .Value IsNot Nothing Then
        Filter = " and 仓库 = '" & .Value & "'"
    End If
End With
With e.Form.Controls("khname")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If
        Filter = 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("rdo1").Checked = True
    If Filter >"" Then
        Filter = Filter & " And "
    End If
    Filter = Filter & "单据状态='已审核'"
End If
If e.Form.Controls("rdo2").Checked = True
    If Filter >"" Then
        Filter = Filter & " And "
    End If
    Filter = Filter & "单据状态<>'已审核' or 单据状态 is null"
End If
Tables("销售单明细").Filter = Filter
If Tables("销售单明细").rows.count=0
    Tables("销售单明细").GrandTotal = False
Else
    Tables("销售单明细").Cols("匹数").GrandTotal = True
    Tables("销售单明细").Cols("米数").GrandTotal = True
    Tables("销售单明细").GrandTotal = True '显示合计模式
End If


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


加好友 发短信
等级:九尾狐 帖子:2552 积分:20045 威望:0 精华:0 注册:2012/5/19 11:57:00
  发帖心情 Post By:2014/11/20 22:22:00 [只看该作者]

出错了 选产品 其它不选 出错了


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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2014/11/20 22:24:00 [只看该作者]

 

Dim Filter As String = "1=1"
With e.Form.Controls("pmname")
    If .Value IsNot Nothing Then
        Filter &= " and 产品名称 = '" & .Value & "'"
    End If
End With

With e.Form.Controls("ckname")
    If .Value IsNot Nothing Then
        Filter &= " and 仓库 = '" & .Value & "'"
    End If
End With
With e.Form.Controls("khname")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If
        Filter = 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("rdo1").Checked = True
    If Filter >"" Then
        Filter = Filter & " And "
    End If
    Filter = Filter & "单据状态='已审核'"
End If
If e.Form.Controls("rdo2").Checked = True
    If Filter >"" Then
        Filter = Filter & " And "
    End If
    Filter = Filter & "单据状态<>'已审核' or 单据状态 is null"
End If
Tables("销售单明细").Filter = Filter
If Tables("销售单明细").rows.count=0
    Tables("销售单明细").GrandTotal = False
Else
    Tables("销售单明细").Cols("匹数").GrandTotal = True
    Tables("销售单明细").Cols("米数").GrandTotal = True
    Tables("销售单明细").GrandTotal = True '显示合计模式
End If


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


加好友 发短信
等级:九尾狐 帖子:2552 积分:20045 威望:0 精华:0 注册:2012/5/19 11:57:00
  发帖心情 Post By:2014/11/20 22:25:00 [只看该作者]

搞定了

多谢

 


 回到顶部