Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB Databases Basics
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
VB Databases Basics Beginning-level VB coding questions specific to using VB with databases. Issues not specific to database use will be redirected to other forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB Databases Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 22nd, 2006, 12:43 PM
Registered User
 
Join Date: Aug 2006
Location: Abuja, FCT, Nigeria.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to timdasa Send a message via Yahoo to timdasa
Default Help: Running Sum (or Cumulative Sum)

I am writing a program in VB6 with ms Access database, and I use VB6 Report designer (without data environment). I need help on how to calculate cumulative sum (or running sum) of a field in the table for each record, and display the resulting sum as a column in the report.

example:
supplierName DateofSupply AmountSupplied
ABC PLC 10/11/2004 2000
Delight Inc. 04/02/2005 5000
Kings International 06/02/2005 1000
Logic Systems 09/02/2005 1500
Horizons Intl 16/02/2005 3000


The intended result should be as shown below:
supplierName DateofSupply AmountSupplied CumulativeSupply
ABC PLC 10/11/2004 2000 2000
Delight Inc. 04/02/2005 5000 6500
Kings International 06/02/2005 1000 7500
Logic Systems 09/02/2005 1500 9000
Horizons Intl 16/02/2005 3000 12000


Please can someone help me out with the code or a sample that does this task.
Thanks in advance.

Reply With Quote
  #2 (permalink)  
Old August 22nd, 2006, 03:12 PM
Friend of Wrox
 
Join Date: Nov 2004
Location: Port Orchard, WA, USA.
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

In the OnFormat event of the report add the current record's value to a module-scope tallying variable, and then set the value of an unbound control to the new value.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Issue with a Running Sum MArgente Access 1 June 11th, 2007 06:45 AM
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
How to get Cumulative Sum of a Field badsy Crystal Reports 1 January 20th, 2006 05:09 PM
Running Sum semooth Access 2 July 21st, 2004 09:17 PM



All times are GMT -4. The time now is 07:58 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.