以文本方式查看主题

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

--  作者:zhangchi96
--  发布时间:2013/6/21 9:51:00
--  表间引用的代码编写问题

在DataDolChanged事件中语句,这个语句的目的是在编辑了单元格之后进行表间引用。

  If e.DataCol.name = "岗位" Then

      If e.NewValue Is Nothing Then

         e.DataRow("工资") = Nothing

     Else

         Dim dr As DataRow

         dr =DataTables("字典").Find("[岗位]=\'" & e.newvalue & "\'")

         If dr IsNot Nothing Then

          e.DataRow("工资") = dr("工资")

         End If

      End If

  End If

 

请教各位,在表属性的AfterEdit事件和按钮控件的click事件中,进行表间引用的代码怎么写?


--  作者:Bin
--  发布时间:2013/6/21 9:56:00
--  
一样的.

AfterEdit代码差不多的啊

按钮的话把 e.DataRow 换
 tables("XX").current

--  作者:zhangchi96
--  发布时间:2013/6/21 10:00:00
--  

原来的DataDolChanged事件 是数据编辑了有变化才执行

现在的AfterEdit事件是编辑了就执行,不管有没有变化


--  作者:zhangchi96
--  发布时间:2013/6/23 15:31:00
--  
恳请大侠帮我把我发的代码事件改成  AfterEdit事件和click事件,谢谢!
--  作者:狐狸爸爸
--  发布时间:2013/6/24 9:02:00
--  
 If e.Col.name = "岗位" Then

      If e.row.Isnull("岗位") Then

         e.Row("工资") = Nothing

     Else

         Dim dr As DataRow

         dr =DataTables("字典").Find("[岗位]=\'" & e.row("岗位")  & "\'")

         If dr IsNot Nothing Then

              e.Row("工资") = dr("工资")

         End If

      End If

  End If