Wrox Programmer Forums
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 9th, 2007, 11:37 PM
Authorized User
 
Join Date: Jun 2007
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default Issue with a Running Sum

On my report, each record has two values I want to sum up. They are Quantity and Accrued Interest. I set up an unbound text box called Total that correctly sums up these two values. All this is done in the detail section of the report. Now, I want to set up a running sum of all the Total fields into another unbound text box called CusipTotal. CusipTotal is in a different section footer than the detail. My problem is, with my code, the calculated field for CusipTotal is only giving me the final sum (quantity + accrued interest), not the sum of all of them.

Here is my code:
Code:
Option Compare Database
Dim gbl_CusipTotal As Double


Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
Dim dblTotal As Double
dblTotal = 0
dblTotal = Me.Quantity + Me.[Accrued Interest]
Me.Total = dblTotal 'Display Total for current record.
gbl_CusipTotal = gbl_CusipToal + dblTotal 'Add totals from all records for group

End Sub

Private Sub CusipFooter_Print(Cancel As Integer, PrintCount As Integer)
Me.CusipTotal = gbl_CusipTotal
gbl_CusipTotal = 0


End Sub
I set up a watch and used Step Into to try and debug it. Every time Detail_Print is executed, the value of gbl_CusipTotal is reset to nothing. Any help?

Thanks
Mark

 
Old June 11th, 2007, 06:45 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Perhaps you can generate this value in the query behind the report and take it from there.

mmcdonal





Similar Threads
Thread Thread Starter Forum Replies Last Post
Running Sum in Subform Odeh Naber Access 2 May 14th, 2007 06:45 AM
"almost" a running sum I guess RobCarter SQL Server 2000 8 March 16th, 2007 02:00 AM
Help: Running Sum (or Cumulative Sum) timdasa VB Databases Basics 1 August 22nd, 2006 03:12 PM
sum ibelta Access 2 February 15th, 2005 08:53 AM
Running Sum semooth Access 2 July 21st, 2004 09:17 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.