以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [求助]多条件下的跨表引用问题  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=123316)

--  作者:y2287958
--  发布时间:2018/8/12 10:09:00
--  

表B的DataColChanged事件设置以下代码

Dim dr As DataRow = e.DataRow
Select Case e.DataCol.Name
    Case "学年","年级","课程"
        If dr.IsNull(e.DataCol.Name) Then
            dr("学时") = Nothing
        Else
            Dim fdr As DataRow = DataTables("表A").find("学期=\'" & dr("学年") & "\' and 年级=\'" & dr("年级") & "\' and 课程=\'" & dr("课程") & "\'")
            If fdr IsNot Nothing
                dr("学时") = fdr("学时")
            End If
        End If
End Select