简体   繁体   English

访问形式中记录源的总和

[英]Sum of a record source in access forms

I have a query that has the following display: 我有一个具有以下显示的查询:

type $ value 输入$值
1 5 1 5
1 3 1 3
1 2 1 2
2 1 2 1
2 3 2 3

This query is the record source of my form I would like the form to display the data as so 此查询是我表单的记录源,我希望表单按原样显示数据

type Sum of value 类型值总和
1 10 1 10
2 4 2 4
is there a vba or setting way to achieve that ? 是否有VBA或设置方法来实现这一目标?

The proper way to do that is to use an aggregation function in your query, in your case it would be sum . 这样做的正确方法是在查询中使用聚合函数,在您的情况下为sum Your query will look like this. 您的查询将如下所示。

SELECT Type, SUM(value) As Total FROM table GROUP BY Type;

if you use the graphical query builder then you will have to follow this 如果你使用图形查询生成器,那么你将不得不遵循这个

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM