以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  下面代码为什么为循环呢?  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=90725)

--  作者:yancheng
--  发布时间:2016/9/20 17:24:00
--  下面代码为什么为循环呢?
导入材料明细 表的,当前行,事件。写入如下。
当点击  导入材料.导入材料明细"  表,切换当前行时,如果 dr.IsNull("定额编码")=False  。
调试会弹出,0,1 的循环。无法退出。

If Forms("导入材料").Opened AndAlso Forms.ActiveForm.Name = "导入材料"  Then
    Dim dr As Row = Tables("导入材料.导入材料明细").Current
    MessageBox.show(0)
    If dr IsNot Nothing AndAlso dr.IsNull("定额编码")=False Then
        Dim i As Integer= Tables("材料").FindRow("定额编码 = \'" & dr("定额编码") & "\'")
        If i >= 0 Then
            MessageBox.show(1)
            Tables("材料").Position = i
        End If
    End If
End If

--  作者:yancheng
--  发布时间:2016/9/20 17:26:00
--  
我把:材料_导入材料明细。的关联,单向生成表,关闭了。好像不循环了。
--  作者:有点蓝
--  发布时间:2016/9/20 17:36:00
--  
Tables("材料")是不是又定位Tables("导入材料.导入材料明细")了,这样试试

If Forms("导入材料").Opened AndAlso Forms.ActiveForm.Name = "导入材料"  Then
    Dim dr As Row = Tables("导入材料.导入材料明细").Current
    MessageBox.show(0)
    If dr IsNot Nothing AndAlso dr.IsNull("定额编码")=False Then
        Dim i As Integer= Tables("材料").FindRow("定额编码 = \'" & dr("定额编码") & "\'")
        If i >= 0 Then
            MessageBox.show(1)
            SystemReady = False
            Tables("材料").Position = i
            SystemReady = True
        End If
    End If
End If