以文本方式查看主题

-  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=93549)

--  作者:misamisali
--  发布时间:2016/12/1 10:18:00
--  跨表引用,如何设置只引用部分数据
我现在有3个表:工资表, 岗位薪级表, 特殊薪级表

1、通过“岗位薪级表”  ,引用不同“职务”对应的“岗位工资”,引用到工资表中。
2、但是其中有3个人,是通过“特殊薪级表”来匹配的,引用“姓名”对应的“岗位工资”,引用到工资表中。

问题,我怎么下面代码中,剔除这三个人,在代码1中不执行引用。


图片点击可在新窗口打开查看此主题相关图片如下:岗位薪级.png
图片点击可在新窗口打开查看

代码1:
If e.DataCol.Name = "职务" Then
    If e.NewValue Is Nothing Then
        e.DataRow("岗位工资") = Nothing
        e.DataRow("保密津贴") = Nothing
        e.DataRow("竞业限制金") = Nothing
    Else
        Dim dr As DataRow
        dr = DataTables("岗位薪级表").Find("[职务] = \'" & e.NewValue & "\'")
        If dr IsNot Nothing
            e.DataRow("岗位工资") = dr("岗位工资")
            e.DataRow("保密津贴") = dr("保密津贴")
            e.DataRow("竞业限制金") = dr("竞业限制金") 
        End If
    End If
End If


代码2:


图片点击可在新窗口打开查看此主题相关图片如下:特殊薪级.png
图片点击可在新窗口打开查看

If e.DataCol.Name = "姓名" Then
    If e.NewValue Is Nothing Then
        e.DataRow("岗位工资") = Nothing
        e.DataRow("保密津贴") = Nothing
        e.DataRow("竞业限制金") = Nothing
    Else
        Dim dr As DataRow
        dr = DataTables("特殊薪级表").Find("[姓名] = \'" & e.NewValue & "\'")
        If dr IsNot Nothing
            e.DataRow("岗位工资") = dr("岗位工资")
            e.DataRow("保密津贴") = dr("保密津贴")
            e.DataRow("竞业限制金") = dr("竞业限制金")
        End If
    End If
End If



[此贴子已经被作者于2016/12/1 10:43:28编辑过]

--  作者:有点蓝
--  发布时间:2016/12/1 10:35:00
--  

If e.DataCol.Name = "职务" Then
    If e.NewValue Is Nothing orelse e.DataRow.isnull("姓名") Then
        e.DataRow("岗位工资") = Nothing
        e.DataRow("保密津贴") = Nothing
        e.DataRow("竞业限制金") = Nothing
    Else
        Dim dr As DataRow
        dr = DataTables("其他薪级表").Find("[姓名] = \'" & e.DataRow("姓名") & "\'")
        If dr Is Nothing
            dr = DataTables("岗位薪级表").Find("[职务] = \'" & e.NewValue & "\'")
            If dr IsNot Nothing
                e.DataRow("岗位工资") = dr("岗位工资")
                e.DataRow("保密津贴") = dr("保密津贴")
                e.DataRow("竞业限制金") = dr("竞业限制金")
            End If
        End If
    End If
End If

--  作者:misamisali
--  发布时间:2016/12/1 10:45:00
--  
版主,你代码两边都无效了…… 引用职务  和姓名  无法执行了。
我的意思是:代码1,A,B,C三个人的姓名来取消他们的引用效果。
        A,B,C, 三人在代码2中引用

--  作者:有点蓝
--  发布时间:2016/12/1 10:48:00
--  
代码2保持不变,代码1 改为2楼的代码
--  作者:misamisali
--  发布时间:2016/12/1 10:58:00
--  
代码1不运行,代码2是好的,就是能不能在代码1中,加一个判断条件,如果姓名是 A,B,C这三个人,则取消代码1的引用。
--  作者:有点蓝
--  发布时间:2016/12/1 11:02:00
--  
贴出事件完整代码,或者上传例子测试