以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  [求助]帮忙给看一下筛选的问题  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=91608)

--  作者:viking
--  发布时间:2016/10/14 15:15:00
--  [求助]帮忙给看一下筛选的问题
帮忙给看一下筛选的问题,头晕了!

更改sz控件的内容,筛选没有反应!

If Forms("记账确认").Opened Then
    Dim rqsr As WinForm.DateTimePicker = e.Form.Controls("日期输入")
    Dim rq As String = rqsr.Value
    Dim sz As String = e.Sender.Value
    Dim jesr As WinForm.TextBox = e.Form.Controls("金额输入")
    Dim je As Double = jesr.Value
    If rq Is Nothing And sz Is Nothing And je = 0 Then
        Tables("日记账").Filter = ""
    ElseIf rq IsNot Nothing And sz Is Nothing And je = 0 Then
        Tables("日记账").Filter = "[日期] = \'" & rq & "\'"
    ElseIf  rq Is Nothing And sz = "收入" And je = 0 Then
        Tables("日记账").Filter = "[收入] is not null"
    ElseIf  rq Is Nothing And sz = "支出" And je = 0 Then
        Tables("日记账").Filter = "[支出] is not null"
    ElseIf  rq Is Nothing And sz Is Nothing And je <> 0 Then
        Tables("日记账").Filter = "[收入] = \'" & je & "\' or [支出] = \'" & je & "\'"
    ElseIf rq IsNot Nothing And  sz = "收入" And je = 0 Then
        Tables("日记账").Filter = "[日期] = \'" & rq & "\' and [收入]  is not null"
    ElseIf rq IsNot Nothing And  sz = "支出" And je = 0 Then
        Tables("日记账").Filter = "[日期] = \'" & rq & "\' and [支出]  is not null"
    ElseIf rq IsNot Nothing And sz Is Nothing And je <> 0 Then
        Tables("日记账").Filter = "[日期] = \'" & rq & "\' and [收入] = \'" & je & "\' or [日期] = \'" & rq & "\' and [支出] = \'" & je & "\'"
    ElseIf  rq Is Nothing And sz = "收入" And je <> 0 Then
        Tables("日记账").Filter = "[收入] = \'" & je & "\'"
    ElseIf  rq Is Nothing And sz = "支出" And je <> 0 Then
        Tables("日记账").Filter = "[支出] = \'" & je & "\'"
    ElseIf  rq IsNot Nothing And sz = "收入" And je <> 0 Then
        Tables("日记账").Filter = "[日期] = \'" & rq & "\' and [收入] = \'" & je & "\'"
    ElseIf  rq IsNot Nothing And sz = "支出" And je <> 0 Then
        Tables("日记账").Filter = "[日期] = \'" & rq & "\' and [支出] = \'" & je & "\'"
    End If
End If


[此贴子已经被作者于2016/10/14 15:21:53编辑过]

--  作者:有点蓝
--  发布时间:2016/10/14 15:55:00
--  
msgbox(Tables("日记账").Filter),弹出内容看看,自己比较sz的内容
--  作者:viking
--  发布时间:2016/10/14 16:05:00
--  
我去看看
做这种筛选,又简单的办法吗?
[此贴子已经被作者于2016/10/14 16:04:51编辑过]

--  作者:有点蓝
--  发布时间:2016/10/14 16:12:00
--  
没看懂你的逻辑,被绕晕了
--  作者:viking
--  发布时间:2016/10/14 23:31:00
--  
知道错误在哪里了,
 Tables("日记账").Filter = "[收入] is not null"
收入是数值列,应该是
 Tables("日记账").Filter = "[收入] <> 0 "