以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 为什么不起作用 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=69701) |
||||
-- 作者:shiliang -- 发布时间:2015/6/9 15:54:00 -- 为什么不起作用 Select Case e.DataCol.Name Case "部门类别" Dim bmlbs As List(Of String) = DataTables("部门信息表").GetValues("部门类别") Dim lydws As List(Of String) = DataTables("部门信息表").GetValues("领用单位表名") For Each bmlb As String In bmlbs If DataTables("部门信息表").Datacols.Contains(bmlb) Then If e.DataRow("部门类别") = bmlb Then For Each lydw As String In lydws If DataTables("部门信息表").Datacols.Contains(lydw) Then e.DataRow("分配表名") = lydw End If Next End If End If Next End Select 麻烦给看一下为什么不起作用 |
||||
-- 作者:Bin -- 发布时间:2015/6/9 15:56:00 -- 你要做什么? 出现什么问题? |
||||
-- 作者:shiliang -- 发布时间:2015/6/9 15:59:00 -- 部门信息表含有“部门类别” “领用单位表”两列,在另一表中填入部门类别,领用单位列自动从部门信息表提取领用单位表填入。 |
||||
-- 作者:大红袍 -- 发布时间:2015/6/9 16:04:00 -- 上传具体例子,或者加入msgbox调试
|
||||
-- 作者:shiliang -- 发布时间:2015/6/9 16:08:00 -- Select Case e.DataCol.Name Case "出库单号" Dim bmcls As List(Of String) = DataTables("部门信息表").GetValues("领用单位表名") For Each bmcl As String In bmcls If DataTables.Contains(bmcl) Then Dim dh As DataRow = DataTables(bmcl).Find("[出库单号] = \'" & e.NewValue & "\'") If dh IsNot Nothing Then e.Cancel = True End If \'Dim ckdh As DataRow = DataTables(bmcl).Find("[出库单号] = \'" & e.NewValue & "\'") If dh Is Nothing Then \'Dim bms As List(Of String) = DataTables("部门").GetValues("部门类别") \' For Each bm As String In bms \' If DataTables.Contains(bm) Then If e.DataRow("记账") = True And e.DataRow("分配表名") = bmcl Then Dim nma() As String = {"物料代码","物料名称","规格型号","常用计量单位","加权平均单价","出库数量","出库金额","出库日期","出库单号","作业项目","成本项目","材料用途","领用人"} \'A表数据来源列 Dim nmb() As String = {"物料代码","物料名称","规格型号","常用计量单位","加权平均单价","出库数量","出库金额","领用日期","出库单号","作业项目","成本项目","材料用途","领用人"} \'B表数据接收列 Dim dr As DataRow = DataTables(bmcl).AddNew() For i As Integer = 0 To nma.Length - 1 dr(nmb(i)) = e.DataRow(nma(i)) Next End If \' End If \' Next End If End If Next End Select |
||||
-- 作者:shiliang -- 发布时间:2015/6/9 16:09:00 -- 上述代码有的表起作用有的表不起作用 |
||||
-- 作者:shiliang -- 发布时间:2015/6/9 16:10:00 --
|
||||
-- 作者:shiliang -- 发布时间:2015/6/9 16:10:00 -- 请给看一下,在材料出库表中 |
||||
-- 作者:大红袍 -- 发布时间:2015/6/9 16:26:00 -- 别的表 Datacolchanging 事件有影响
Select Case e.DataCol.Name |
||||
-- 作者:shiliang -- 发布时间:2015/6/9 16:28:00 -- 原来没问题,修改了第三段代码的表名后就出问题了 |