简体   繁体   English

过滤后访问报告汇总数据

[英]Access report summing data after the filtering

Here is the structure, we're using Access 2007 with SQL Server. 这是结构,我们将Access 2007与SQL Server一起使用。 We've got the query established that extracts the data we are looking for and then filtering on a specific ID. 我们已经建立了查询,该查询将提取我们要查找的数据,然后根据特定的ID进行过滤。 The query results are then reported on. 然后报告查询结果。 On the report we need to have a sum of the field "Amount" on the report. 在报告上,我们需要在报告上具有字段“金额”的总和。 Here is the problem, the report is processing the running sum on the entire database and not on the filtered query results. 这是问题所在,报表正在处理整个数据库上的运行总和,而不是过滤后的查询结果。

I've tried changing the report running sum parameters with no success. 我尝试更改报表运行总和参数没有成功。 As well as establishing grouping, but naturally there is only one group, so that is not really successful. 除了建立分组以外,自然也只有一组,所以这并不是真正的成功。

Any help would be appreciated. 任何帮助,将不胜感激。

In the control you wish to display the sum, enter this into the ControlSource property: 在您希望显示总和的控件中,将其输入到ControlSource属性中:

=Sum(Nz([Amount],0))

See if that helps you. 看看是否有帮助。

How do you specify the datasource to your report? 如何为报表指定数据源?

You may open the report this way... 您可以通过这种方式打开报告...

DoCmd.OpenReport "MyReport", acViewPreview, , "Id = " & MyId

Or This way... 或者这样

DoCmd.OpenReport "MyReport", acViewPreview, , , , "Id = " & myId
.......
Private Sub Report_Open(Cancel As Integer)
Me.RecordSource = "Select fields from view where " & OpenArgs
End Sub

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

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