以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  [求助]取消查询结果中的空值?  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=107820)

--  作者:Engineer1
--  发布时间:2017/10/10 21:01:00
--  [求助]取消查询结果中的空值?

本来在afterload 过滤掉 编号为空的数据,

Tables("form_table5").Filter = "[报告编号] <> \'""\'"

但查询后没生成报告编号的又显示出来了,应该怎么才能把没有报告编号的也过滤掉呢?

查询代码如下:

Dim Filter As String
With e.Form.Controls("combobox6")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "检测部门 = \'" & .Value & "\'"
    End If
   
End With
With e.Form.Controls("dtp7")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "报告日期 >= #" & .Value & "#"
    End If
   
End With
With e.Form.Controls("dtp8")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "报告日期 <= #" & .Value & "#"
    End If
End With
Dim txt As String = e.Form.Controls("TextBox12").Text

Dim tbl As Table = Tables("form_Table5")
If txt = "" Then
    tbl.Filter = ""
Else
    txt = "\'%" & txt & "%\'"
    tbl.Filter = "委托单位 Like " & txt & " "
End If
If Filter > "" Then
   
    Tables("form_table5").Filter = Filter
End If


--  作者:有点蓝
--  发布时间:2017/10/10 21:08:00
--  
Dim Filter As String = "[报告编号] <> \'\' and [报告编号] is not null "
With e.Form.Controls("combobox6")
    If .Value IsNot Nothing Then
        Filter = Filter & " and 检测部门 = \'" & .Value & "\'"
    End If
    
End With
With e.Form.Controls("dtp7")
    If .Value IsNot Nothing Then
        Filter = Filter & " and 报告日期 >= #" & .Value & "#"
    End If
    
End With
With e.Form.Controls("dtp8")
    If .Value IsNot Nothing Then
        Filter = Filter & " and 报告日期 <= #" & .Value & "#"
    End If
End With
Dim txt As String = e.Form.Controls("TextBox12").Text
If txt > "" Then
    txt = "\'%" & txt & "%\'"
    Filter = Filter & "and 委托单位 Like " & txt & " "
End If
Tables("form_table5").Filter = Filter

--  作者:Engineer1
--  发布时间:2017/10/10 22:19:00
--  

谢谢老师的帮助