简体   繁体   中英

Access report summing data after the filtering

Here is the structure, we're using Access 2007 with SQL Server. We've got the query established that extracts the data we are looking for and then filtering on a specific 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:

=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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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