以文本方式查看主题

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

--  作者:布莱克朱
--  发布时间:2011/8/21 9:50:00
--  看看代码有什么问题?

我在全局表事件的DataColChanged设置了这个代码:

 

dr1 =e.DataRow
Dim code As String
For Each dr As DataRow In DataTables("基础设置").DataRows
    If e.DataTable.Name = dr("表名") Then
        If e.DataCol.Name =dr("列名") Then
           
                code = dr("代码编辑器") & vbcrlf
                code = code & "Return Nothing"
                Functions.add("zhi",code)
                Functions.complie()
                Functions.Execute("zhi")
                Functions.remove("zhi")
                Return
            End If
        End If
    End If
Next
Functions.remove("zhi")

 

dr1是全局代码,然后我在表字段的"代码编辑器"的代码如下:

 

Dim dr As DataRow
Dim Filter As String
Filter = "[客户编号] = \'" & dr1("客户编号") & "\'"
dr = DataTables("订单").Find(Filter )
If dr IsNot Nothing Then \'如果找到
        dr1("客户名称") = dr("客户名称")
Else
       dr1("客户名称") = Nothing
End If

 

可以执行,但会出来一个提示为:

 

 

 


图片点击可在新窗口打开查看此主题相关图片如下:未命名.jpg
图片点击可在新窗口打开查看

--  作者:布莱克朱
--  发布时间:2011/8/21 12:06:00
--  

dr1 =e.DataRow
dc =e.DataCol
dt=e.DataTable
Dim code As String
For Each dr As DataRow In DataTables("基础设置").DataRows
    If e.DataTable.Name = dr("表名") Then
        If e.DataCol.Name = "客户编号" Then
            code = dr("代码编辑器") & vbcrlf
            code = code & "Return Nothing"
            Functions.add("zhi",code)
            Functions.complie()
            Functions.Execute("zhi")
            Functions.remove("zhi")
            Return
        End If
    End If
Next
Functions.remove("zhi")

 

如果项目属性里面这样设置,一点问题都没有


--  作者:布莱克朱
--  发布时间:2011/8/21 12:16:00
--  
必须指定列.
--  作者:布莱克朱
--  发布时间:2011/8/21 12:19:00
--  

终于又想明白了.搞定.