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


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

主题:筛选的问题?

帅哥哟,离线,有人找我吗?
有点甜
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | 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


 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | 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


 回到顶部