以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  求教关联表行内容校验  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=183498)

--  作者:xinghuo
--  发布时间:2022/11/7 17:09:00
--  求教关联表行内容校验
关联表一字符列,第一行选“是”,第二行必须是“否”,反之 一样,就是两行不能相同的.    在子表代码怎么写?
[此贴子已经被作者于2022/11/7 17:11:28编辑过]

--  作者:有点蓝
--  发布时间:2022/11/7 17:33:00
--  
子表datacolchanging事件

If e.DataCol.Name = "第一列" Then
    Dim idx As Integer = Tables("关联表").FindRow(e.DataRow)
    If idx > -1 Then
        Dim r As Row
        If idx Mod 2 = 0 Then
            If idx <= Tables("关联表").rows.Count - 2 Then 
                r = Tables("关联表").rows(idx + 1)
            End If
        Else
            If idx > 0 Then 
                r = Tables("关联表").rows(idx - 1)
            End If
        End If
        If r IsNot Nothing Then
            If e.NewValue = r("第一列") Then
                MsgBox("不能相同")
                e.Cancel = True
            End If 
        End If 
    End If
End If

--  作者:xinghuo
--  发布时间:2022/11/7 20:13:00
--  
谢谢!