Rss & SiteMap

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

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

标题:窗口统计求助

1楼
实话实说 发表于:2009/12/3 23:52:00

这是表AfterSelRangeChange时间代码


if Forms("主窗口").Opened then
    Dim Sum,Average,Count As Integer
    With CurrentTable
        Sum = CurrentTable.Aggregate(AggregateEnum.Sum, .TopRow, .LeftCol, .BottomRow, .RightCol)
        Average = CurrentTable.Aggregate(AggregateEnum.Average, .TopRow, .LeftCol, .BottomRow, .RightCol)
        Count = CurrentTable.Aggregate(AggregateEnum.Count, .TopRow, .LeftCol, .BottomRow, .RightCol)
    End With
    Forms("主窗口").Controls("Label1").text ="    累计: " & Cstr(sum) & "     平均: " & Cstr(Average) & "     计数: " & Cstr(Count) & " "
end if

对身份证号码字段出错,其它正常,请帮忙改进

图片点击可在新窗口打开查看此主题相关图片如下:snap1.jpg
图片点击可在新窗口打开查看
[此贴子已经被作者于2009-12-3 23:52:33编辑过]
2楼
实话实说 发表于:2009/12/4 0:02:00
身份证号码是字符型,
3楼
mr725 发表于:2009/12/4 0:09:00
身份证号码 列有需要求累计值和平均值吗? 排除调这一列吧。
4楼
czy 发表于:2009/12/4 0:27:00
if Forms("主窗口").Opened then
    Dim t as Table = CurrentTable
    For c As Integer = t.LeftCol To t.RightCol
        If c = 0 then
            Return
        End IF
        If t.Cols(c).IsNumeric = False Then
            Return
        End If
    Next
    Dim Sum,Average,Count As Integer
    Sum = CurrentTable.Aggregate(AggregateEnum.Sum, t.TopRow, t.LeftCol, t.BottomRow, t.RightCol)
    Average = CurrentTable.Aggregate(AggregateEnum.Average, t.TopRow, t.LeftCol, t.BottomRow, t.RightCol)
    Count = CurrentTable.Aggregate(AggregateEnum.Count, t.TopRow, t.LeftCol, t.BottomRow, t.RightCol)
    Forms("主窗口").Controls("Label1").text ="    累计: " & Cstr(sum) & "     平均: " & Cstr(Average) & "     计数: " & Cstr(Count) & " "
end if
共4 条记录, 每页显示 10 条, 页签: [1]

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

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