以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  [求助]e.Cancel=True 无效或不执行  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=107993)

--  作者:zhull1028
--  发布时间:2017/10/13 20:32:00
--  [求助]e.Cancel=True 无效或不执行
请高手看看是怎么回事?
在窗口的BeforeClose中,每次重新打开项目,e.Cancel=True都不执行或无效,需要再次进入编辑保存才会有效,不知是何原因?代码如下:
If Tables("凭证.凭证分录.外币分录").Rows.Count()=0 Then
    messagebox.show("必须录入原币金额!","提示",MessageBoxButtons.OK ,MessageBoxIcon.Information)
    e.Cancel=True
Else
    Dim bbje As Single =Tables("凭证.凭证分录.外币分录").Current("本币金额")
    Dim fx As String=Tables("凭证.凭证分录.外币分录").Current("方向")
    Dim bzdm As String=Tables("凭证.凭证分录.外币分录").Current("币种代码")
    Dim ybje As Single =Tables("凭证.凭证分录.外币分录").Current("原币金额")
    Dim hl As Single =Tables("凭证.凭证分录.外币分录").Current("汇率")
    Dim jfje As Single= Tables("凭证.凭证分录").Current("借方金额")
    Dim dfje As Single=Tables("凭证.凭证分录").Current("贷方金额")

    If bzdm="" Or fx="" Or ybje=0 Or hl=0 Then
        messagebox.show("各项目不能为空!")
        e.Cancel=True
    Else
        If fx="借"  Then
            If bbje<>jfje Then
                messagebox.show("本币金额与分录借方金额不一致!")
                e.Cancel=True
            End If
        End If
        If fx="贷" Then
            If bbje<>dfje Then
                messagebox.show("本币金额与分录贷方金额不一致!")
                e.Cancel=True
            End If
        End If
    End If
End If

[此贴子已经被作者于2017/10/13 20:37:27编辑过]

--  作者:有点蓝
--  发布时间:2017/10/13 20:41:00
--  
窗口类型是主窗口?这个主表有多个主窗口?
[此贴子已经被作者于2017/10/13 20:40:42编辑过]

--  作者:zhull1028
--  发布时间:2017/10/16 10:12:00
--  
窗口类型是:模式
--  作者:有点甜
--  发布时间:2017/10/16 10:49:00
--  
升级到最新版foxtable。如果还有问题,做一个例子发上来测试。