以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  [求助]筛选  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=56694)

--  作者:风声
--  发布时间:2014/9/10 20:26:00
--  [求助]筛选


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

Dim Filter As String
With e.Form.Controls("商品名称")
    If .Value IsNot Nothing Then
        Filter = "商品名称 = \'" & .Value & "\'"
    End If
End With
With e.Form.Controls("客户名称")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "客户名称 = \'" & .Value & "\'"
    End If
End With
With e.Form.Controls("来源")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "来源 = \'" & .Value & "\'"
    End If
End With
With e.Form.Controls("开始日期")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "日期 >= #" & .Value & "#"
    End If
End With
With e.Form.Controls("结束日期")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "日期 <= #" & .Value & "#"
    End If
End With
If e.Form.Controls("已付").Checked = True \' 如果付款状态选择了"已付"
          If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "已付款 = True"
End If
If e.Form.Controls("未付").Checked = True \' 如果付款状态选择了"未付"
          If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "已付款 = False Or 已付款 Is Null"
End If
If Filter > "" Then
    Tables("蓝峰管理_Table3").Filter = Filter
End If

 

 

 

谢谢老师帮我修改一下上面的代码

 


--  作者:有点甜
--  发布时间:2014/9/10 20:31:00
--  

 全部的.Value改成.Text

 

 再有一个,你肯定有一个控件的名字写错了。


--  作者:风声
--  发布时间:2014/9/10 21:21:00
--  


图片点击可在新窗口打开查看此主题相关图片如下:360软件小助手截图20140910212033.png
图片点击可在新窗口打开查看

 

还是不行


--  作者:有点甜
--  发布时间:2014/9/10 21:23:00
--  

 你控件绝对写错了,请认真核对每一个控件的名称。

 

 实在不行,就请把例子发上来看看


--  作者:风声
--  发布时间:2014/9/10 22:13:00
--  
问题出在蓝峰管理表的蓝峰管理窗口的进销存页面集合里的筛选按钮中
 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:蓝峰净水.table

[此贴子已经被作者于2014-9-10 22:24:00编辑过]

--  作者:有点甜
--  发布时间:2014/9/10 22:22:00
--  

Dim Filter As String
With e.Form.Controls("商品名称")
    If .value IsNot Nothing Then
        Filter = "商品名称 = \'" & .Text & "\'"
    End If
End With
With e.Form.Controls("客户名称")
    If .value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "客户名称 = \'" & .Text & "\'"
    End If
End With
With e.Form.Controls("ComboBox3")
    If .value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "来源 = \'" & .Text & "\'"
    End If
End With
With e.Form.Controls("开始日期")
    If .value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "日期 >= #" & .Text & "#"
    End If
End With
With e.Form.Controls("结束日期")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "日期 <= #" & .Text & "#"
    End If
End With
If e.Form.Controls("已付").Checked = True \' 如果付款状态选择了"已付"
          If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "已付款 = True"
End If
If e.Form.Controls("未付").Checked = True \' 如果付款状态选择了"未付"
          If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "已付款 = False Or 已付款 Is Null"
End If

If Filter > "" Then
    Tables("蓝峰管理_Table3").Filter = Filter
End If