以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  求统计问题代码修改  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=71012)

--  作者:yaojun
--  发布时间:2015/7/3 10:22:00
--  求统计问题代码修改

我有一“计件工资”主表和一“员工工资”子表

现在对子表“员工工资”的行用日期进行筛选,我想在筛选后的后面再增加一行用来显示当前“姓名”列的“小计”列里的数据合计

代码如下:

Dim Filter As String
With e.Form.Controls("cmbProduct")
    If .Value IsNot Nothing Then
        Filter = "姓名= \'" & .Value & "\'"
    End If
End With


With e.Form.Controls("StartDate")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "完成时间 >= #" & .Value & "#"
    End If
End With
With e.Form.Controls("EndDate")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "完成时间 <= #" & .Value & "#"
    End If
End With
If Filter > "" Then
    Tables("计件工资.员工工资").Filter = Filter
End If

 

 

请老师们帮忙,谢谢了


--  作者:大红袍
--  发布时间:2015/7/3 10:24:00
--  

合计模式

 

http://www.foxtable.com/help/topics/2748.htm

 

http://www.foxtable.com/help/topics/2750.htm

 


--  作者:yaojun
--  发布时间:2015/7/3 10:40:00
--  

With Tables("计件工资.员工工资")
    .Cols("小计").GrandTotal = True \'指定要合计的列
    .Cols("完成数量").GrandTotal = True
    .GrandTotal = True \'显示合计模式
End With

 

谢谢老师,非常感谢


--  作者:yaojun
--  发布时间:2015/7/3 10:48:00
--  
若是“计件工资”主表里的计件工资列里的数据=当前“计件工资.员工工资”里的当前统计数据呢
--  作者:大红袍
--  发布时间:2015/7/3 10:53:00
--  

 用表达式 http://www.foxtable.com/help/topics/0100.htm

 


--  作者:yaojun
--  发布时间:2015/7/3 11:03:00
--  

老师指点的地址是可以实现总的合计数量,但不是我想要的

我想要的是通过

With Tables("计件工资.员工工资")
    .Cols("小计").GrandTotal = True \'指定要合计的列
    .Cols("完成数量").GrandTotal = True
    .GrandTotal = True \'显示合计模式
End With

 

代码以后的新的合计数据

还请老师指教


图片点击可在新窗口打开查看此主题相关图片如下:098.png
图片点击可在新窗口打开查看
合计行是870 而不是当前的 750
[此贴子已经被作者于2015/7/3 11:05:27编辑过]

--  作者:大红袍
--  发布时间:2015/7/3 11:06:00
--  
Tables("计件工资").Current("工资") = Tables("计件工资.员工工资").compute("sum(工资)")
--  作者:yaojun
--  发布时间:2015/7/3 11:24:00
--  
非常感谢大红袍老师,感谢