以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  加载求和  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=111382)

--  作者:有点甜
--  发布时间:2017/12/20 21:13:00
--  

试试这样

 

Select Case e.DataCol.Name
    Case "合格品","不合格品","报废品"
        Dim pr As DataRow

        pr = DataTables("生产排产表").Find("加工工序 = \'" & e.DataRow("加工工序") & "\' and 成品编码 = \'" & e.DataRow("成品编码")& "\' and 生产批次 = \'" & e.DataRow("生产批次")  & "\'")

        If pr is Nothing then
            pr = DataTables("生产排产表").sqlFind("加工工序 = \'" & e.DataRow("加工工序") & "\' and 成品编码 = \'" & e.DataRow("成品编码")& "\' and 生产批次 = \'" & e.DataRow("生产批次")  & "\'")

        end if
        If pr IsNot Nothing Then
            pr(e.DataCol.Name)= e.DataTable.sqlCompute("sum(" & e.DataCol.Name & ")", "加工工序 = \'" & e.DataRow("加工工序") & "\' and 成品编码 = \'" & e.DataRow("成品编码") & "\' and 生产批次 = \'" & e.DataRow("生产批次")& "\' and _Identify <> " & e.DataRow("_Identify")) + e.DataRow(e.DataCol.Name)

            pr.save
        End If       
End Select


--  作者:有点甜
--  发布时间:2017/12/20 21:32:00
--  
请加入msgbox弹出是否执行里面的代码。弹出各个值看是否正确。
--  作者:有点甜
--  发布时间:2017/12/20 21:53:00
--  
没有弹出说明没有触发datacolchanged事件。datacolchanged是你修改了表的某列数据才会触发的。
--  作者:有点甜
--  发布时间:2017/12/20 22:41:00
--  
以下是引用nuoyan88在2017/12/20 21:59:00的发言:
老师,我先在工序记录表窗口中报工,保存之后值在汇总到生产排产表对应的例中。

 

datacolchanged事件触发了没有?加入多个msgbox,能否弹出msgbox?

 

重置列,能否触发datacolchanged


--  作者:有点甜
--  发布时间:2017/12/20 22:47:00
--  
 如果是窗口表,写到窗口表的datacolchanged事件去。
--  作者:有点甜
--  发布时间:2017/12/20 23:06:00
--  

改成

 

            pr(e.DataCol.Name)= e.DataTable.sqlCompute("sum(" & e.DataCol.Name & ")", "加工工序 = \'" & e.DataRow("加工工序") & "\' and 成品编码 = \'" & e.DataRow("成品编码") & "\' and 生产批次 = \'" & e.DataRow("生产批次")& "\' and [_Identify] <> " & e.DataRow("_Identify")) + e.DataRow(e.DataCol.Name)


--  作者:有点甜
--  发布时间:2017/12/20 23:09:00
--  
以下是引用nuoyan88在2017/12/20 23:07:00的发言:
老师,汇总之后如果有删除明细,汇总结果却不变

 

DataRowDeleteing、DataRowDeleted事件的代码写了没有?


--  作者:有点甜
--  发布时间:2017/12/21 9:00:00
--  
以下是引用nuoyan88在2017/12/20 23:14:00的发言:
是窗口事件吗?没呢,不知道怎么写?谢谢

 

你问过类似的啊,你先要把基础学一下,不然你做的系统问题漏洞都多。

 

http://www.foxtable.com/bbs/dispbbs.asp?BoardID=2&ID=110176&skin=0