以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  怎么加入判断没有此行数据的代码  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=87215)

--  作者:114039247
--  发布时间:2016/7/6 2:01:00
--  怎么加入判断没有此行数据的代码
Dim Filter As String
With e.Form.Controls("textBox1")
    If .Value IsNot Nothing Then
        Filter = "工程 = \'" & .Value & "\'" & "and 完成 = True"

    End If
End With
If Filter > "" Then
    Tables("工程").Filter = Filter

End If

如果“工程”里面没有“完成 = true ”的 ,会弹出运行错误的代码,要怎么去判断呢? 
对不起,我貌似迷上这软件了

--  作者:大红袍
--  发布时间:2016/7/6 9:54:00
--  

 和这段没有关系,去看你的currentChanged事件,加上判断

 

If e.Table.Current Is Nothing Then reutn \'写在第一行


--  作者:114039247
--  发布时间:2016/7/6 15:58:00
--  
那里不对吗? 还是有这个运行错误

我筛选的是窗口里面的表(副本)
If Forms("任务提醒").Opened Then \'如果窗口已经打开
Dim tb As Table = Tables("任务提醒_table1")
If tb.Current Is Nothing Then 
msgbox("没有找到")
Return 

End If
End If

窗口按钮:

Dim Filter As String
With e.form.Controls("textBox1")
    If .Value IsNot Nothing Then
        Filter = "交接人 = \'" & .Value & "\'" & "and 完成 = True"
End If
 End With
Tables("任务提醒_table1").Filter = Filter


--  作者:大红袍
--  发布时间:2016/7/7 0:39:00
--  

下面这段写在最前面去


    Dim tb As Table = Tables("任务提醒_table1")
    If tb.Current Is Nothing Then
        msgbox("没有找到")
        Return  
    End If