Rss & SiteMap

Foxtable(狐表) http://www.foxtable.com

新一代数据库软件,完美融合Access、Foxpro、Excel、vb.net之优势,人人都能掌握的快速软件开发工具!
共4 条记录, 每页显示 10 条, 页签: [1]
[浏览完整版]

标题:看看代码有什么问题?

1楼
布莱克朱 发表于: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
图片点击可在新窗口打开查看
2楼
布莱克朱 发表于: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")

 

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

3楼
布莱克朱 发表于:2011/8/21 12:16:00
必须指定列.
4楼
布莱克朱 发表于:2011/8/21 12:19:00

终于又想明白了.搞定.

共4 条记录, 每页显示 10 条, 页签: [1]

Copyright © 2000 - 2018 foxtable.com Tel: 4000-810-820 粤ICP备11091905号

Powered By Dvbbs Version 8.3.0
Processed in .03125 s, 2 queries.