Foxtable(狐表)用户栏目专家坐堂 → 求助


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

主题:求助

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


加好友 发短信
等级:三尾狐 帖子:668 积分:5184 威望:0 精华:0 注册:2013/10/7 22:27:00
求助  发帖心情 Post By:2017/3/27 0:20:00 [只看该作者]

您好!大师:
这是表的筛选代码,请您帮我帮我优化.谢谢!!!
e.Form.StopRedraw
Dim Filter As String
With e.Form.Controls("款号")
    If .Value IsNot Nothing Then
        Filter = "vdmh = 1 and ffikgn = '" & .Value & "'"
    End If
End With
With e.Form.Controls("xqsufjya")
    If .Value IsNot Nothing Then
        Filter = "vdmh = 1 and xqsufjya = '" & .Value & "'"
    End If
End With
With e.Form.Controls("设计师")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "vdmh = 1 and ymyfjgm = '" & .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 & "vdmhjjad >= '" & .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 & "vdmhjjad <= '" & .Value & "'"
    End If
End With
If e.Form.Controls("已审核").Checked = True   ' 如果付款状态选择了"已付"
    If Filter >"" Then
        Filter = Filter & " And "
    End If
    Filter = Filter & "pjsy = 1"
End If
If e.Form.Controls("未审核").Checked = True '
    If Filter >"" Then
        Filter = Filter & " And "
    End If
    Filter = Filter & "vdmh = 1 and pjsy = 0"
    If Filter > "" Then
    End If
End If
If e.Form.Controls("fixqsu").Checked = True Then
    If Filter >"" Then
        Filter = Filter & " And "
    End If   
    Filter = Filter & "vdmh = 1 and pjsy = 0 and [xqsufjya] <> ('纸样已完成')"
    If Filter > "" Then
    End If
End If
If e.Form.Controls("nnxqsu").Checked = True Then
    If Filter >"" Then
        Filter = Filter & " And "
    End If
    Filter = Filter & "vdmh = 1 and pjsy = 0 and [xqsufjya] = ('纸样已完成')"
    If Filter > "" Then
    End If
End If
If e.Form.Controls("filgsr").Checked = True Then
    If Filter >"" Then
        Filter = Filter & " And "
    End If   
    Filter = Filter & "vdmh = 1 and pjsy = 0 and [xqsufjya] <> ('车板已完成')"
    If Filter > "" Then
    End If
End If
If e.Form.Controls("nnlgsr").Checked = True Then
    If Filter >"" Then
        Filter = Filter & " And "
    End If
    Filter = Filter & "vdmh = 1 and pjsy = 0 and [xqsufjya] = ('车板已完成')"
    If Filter > "" Then
    End If
End If
If e.Form.Controls("thnn").Checked = True Then
    If Filter >"" Then
        Filter = Filter & " And "
    End If
    Filter = Filter & "pjsy = 0 and xqsujgm = '" & User.Name & "'"
    If Filter > "" Then
    End If
End If
If e.Form.Controls("g").Checked = True Then
    If Filter >"" Then
        Filter = Filter & " And "
    End If
    Filter = Filter & "vdmhjjad = '" & Date.Today & "'"
    If Filter > "" Then
    End If
End If
If e.Form.Controls("f").Checked = True Then
    If Filter >"" Then
        Filter = Filter & " And "
    End If
    Dim dt As Date = Date.Today.AddDays(-3)
    Filter = Filter & "vdmhjjad > '" & dt & "'"
    If Filter > "" Then
    End If
End If
If e.Form.Controls("d").Checked = True Then
    If Filter >"" Then
        Filter = Filter & " And "
    End If
    Dim dt As Date = Date.Today.AddDays(-7)
    Filter = Filter & "vdmhjjad > '" & dt & "'"
    If Filter > "" Then
    End If
End If
Tables("qrymyf").Filter = Filter
DataTables("qrymyf").LoadFilter = Filter
DataTables("qrymyf").Load()
谢谢!

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


加好友 发短信
等级:超级版主 帖子:13837 积分:69650 威望:0 精华:0 注册:2016/11/1 14:42:00
  发帖心情 Post By:2017/3/27 1:06:00 [只看该作者]

你的逻辑是这样,这个是无法优化的了。

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


加好友 发短信
等级:三尾狐 帖子:668 积分:5184 威望:0 精华:0 注册:2013/10/7 22:27:00
  发帖心情 Post By:2017/3/27 23:28:00 [只看该作者]

谢谢!

 回到顶部