以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  必填字段,如果未填写,禁止关闭窗口  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=170518)

--  作者:seal51
--  发布时间:2021/7/29 11:42:00
--  必填字段,如果未填写,禁止关闭窗口
窗口AfterClose代码如下:
Dim sts() As String = {"facelb1","facelb2","facename"}
For Each st As String In sts
    If Tables("tblsealface").Current.isnull(st) = True Then
        MessageBox.Show ("请将分类1,分类2,名称段填写完整!","提醒")
        Return
    End If
Next
If DataTables("tblsealface").HasChanges = True Then
    DataTables("tblsealface").Save
End If
这个代码只是提醒了,但是关闭窗口还是新增了一行
如何将必填字段填写完整才能关闭窗口呢?
[此贴子已经被作者于2021/7/29 11:44:54编辑过]

--  作者:有点蓝
--  发布时间:2021/7/29 11:56:00
--  
放到beforeClose事件:http://www.foxtable.com/webhelp/topics/0712.htm
--  作者:seal51
--  发布时间:2021/7/29 12:04:00
--  
把下面代码放到beforeClose事件里
Dim sts() As String = {"facelb1","facelb2","facename"}
For Each st As String In sts
    If Tables("tblsealface").Current.isnull(st) = True Then
        MessageBox.Show ("请将分类1,分类2,名称段填写完整!","提醒")
        Return
    End If
Next
关闭窗口还是新增了一行

--  作者:有点蓝
--  发布时间:2021/7/29 13:32:00
--  
能不能先把帮助都仔细看一遍呢,而不是知道放到beforeClose事件就行了

    If Tables("tblsealface").Current.isnull(st) = True Then
        MessageBox.Show ("请将分类1,分类2,名称段填写完整!","提醒")
e.cancel=true
        Return
    End If