以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  [求助]统计  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=146638)

--  作者:江南小镇
--  发布时间:2020/2/28 11:50:00
--  [求助]统计
老师,如果指定要合计的列不存在就进入下一个要合计的列,如果都不存在也不要报错


         Tables("系统_Table1").Cols("入库_数量").GrandTotal = True \'指定要合计的列
        Tables("系统_Table1").Cols("合计金额").GrandTotal = True


        Tables("系统_Table1").Cols("数量").GrandTotal = True \'指定要合计的列
        Tables("系统_Table1").Cols("金额").GrandTotal = True



        Tables("系统_Table1").GrandTotal = True \'显示合计模式

--  作者:有点蓝
--  发布时间:2020/2/28 12:12:00
--  
for each c as col in Tables("系统_Table1").Cols
if c.IsNumeric then 
c.GrandTotal = True
end if
next

Tables("系统_Table1").GrandTotal = True

--  作者:江南小镇
--  发布时间:2020/2/28 15:38:00
--  
老师,上面代码搞不好了。
--  作者:有点蓝
--  发布时间:2020/2/28 15:57:00
--  
上传实例
--  作者:江南小镇
--  发布时间:2020/2/28 16:53:00
--  
老师,通过组合框赋值到窗口1的表进行指定要合计的列。

 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:统计.rar
 
--  作者:有点蓝
--  发布时间:2020/2/28 17:46:00
--  
valuechanged事件

Dim tj As String = "Select * From {" & e.sender.text & "}"
Tables("窗口1_Table1").Fill(tj ,"数据库" ,False)                  \'加载Table
For Each c As Col In Tables("窗口1_Table1").Cols
    If c.IsNumeric Then
        c.GrandTotal = True
    End If
Next

Tables("窗口1_Table1").GrandTotal = True

--  作者:江南小镇
--  发布时间:2020/2/28 20:19:00
--  
   老师,这个代码怎样修改。    


 Tables("窗口1_Table1").Cols("入库_金额").GrandTotal = True

--  作者:有点蓝
--  发布时间:2020/2/28 21:12:00
--  
不需要这种代码