Foxtable(狐表)用户栏目专家坐堂 → [求助]取消查询结果中的空值?


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

主题:[求助]取消查询结果中的空值?

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


加好友 发短信
等级:童狐 帖子:236 积分:1922 威望:0 精华:0 注册:2017/10/1 12:15:00
[求助]取消查询结果中的空值?  发帖心情 Post By: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


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


加好友 发短信
等级:超级版主 帖子:105948 积分:538809 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By: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
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:童狐 帖子:236 积分:1922 威望:0 精华:0 注册:2017/10/1 12:15:00
  发帖心情 Post By:2017/10/10 22:19:00 [只看该作者]

谢谢老师的帮助

 


 回到顶部