473,395 Members | 1,484 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Running total in a form using a SQL Statement and tables

12
Hi,

I'm trying to create a form that has a running total of the amount an organisation has been invoiced. 1 table (Database) consists of everything I've invoice out. The fields this table has is the Organisation code, name and amounts among many others.

I also have another table (Orgs) that is a comprehensive list of organisation codes, name and a blank field (Organisation_Total).

I've created a form whose Record Source is Orgs. My aim is to use a SQL Statement to populate the blank Total field automatically upon opening it, however I seem to be having some difficulty. I've tried multiple ways of doing it and I have the feeling I'm missing something simple.

The code I have so far is:
Expand|Select|Wrap|Line Numbers
  1. SELECT Orgs.Org_Code as Org_Code, Orgs.Org_Name as Org_Name, case when Database.Org_Code=Orgs.Org_Code then Sum(Total_Invoice_Amount) AS Org_Total else " "
  2. FROM Database
  3. INNER JOIN Orgs ON Orgs.Org_Code = Database.Org_Code 
Any help you can give me would be greatly appreciated.

Thanks

Sunny
Feb 24 '11 #1

✓ answered by TheSmileyCoder

I have uploaded a small example showing a way of doing it. If you have any questions please ask.

4 2252
Jinzuku
12
I think maybe the term "Running Total" was the wrong word to use, since that tends to refer to a cumulative total.

What I'm hoping to have is more an auto-refresh on the totals, so when more data is imported into the database the totals for each organisation will go up if they have been sent a new invoice.
Feb 24 '11 #2
TheSmileyCoder
2,322 Expert Mod 2GB
I have uploaded a small example showing a way of doing it. If you have any questions please ask.
Attached Files
File Type: zip TotalSumExample.zip (19.7 KB, 138 views)
Feb 24 '11 #3
Jinzuku
12
Excellent, that worked like a charm.

Thanks TheSmileyCoder, you've now made me smile too :D

Sunny
Feb 24 '11 #4
TheSmileyCoder
2,322 Expert Mod 2GB
Your welcome. Im glad to hear it made you smile.
Feb 24 '11 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: James Greig | last post by:
hello people, i'm just learning javascript, could someone point me in the direction of an example of the following, or give me some clues as to how it might be done: what i would like to do...
2
by: Ewin | last post by:
I'm a beginner user of MS Access, and I am having a problem building a database with a complex form that enters to several tables. I did not use subforms because I am attempting to emulate...
4
by: Bill Dika | last post by:
Hi I am trying to calculate a running total of a calculated textbox (tbAtStandard) in GroupFooter1 for placement in a textbox (tbTotalAtStandard) on my report in Groupfooter0. The problem...
1
by: annie | last post by:
Hi all, I have recently ported my Access 2000 app to SQL Server, keeping the Access client as the front end using linked tables. I am also using triggers on my SQL tables to trap orphan...
7
by: Shannan Casteel via AccessMonster.com | last post by:
I have a form for entering part numbers along with the associated quantity for each part. There are 25 Part fields and 25 associated Quantity fields. If I go to record 1 and enter part number 1234...
16
by: Gandalf186 | last post by:
I need to create a query that produces running totals for every group within my table for example i wish to see: - Group A 1 5 9 15 Group B
2
by: Jana | last post by:
Using Access 97. Background: I have a main report called rptTrustHeader with a subreport rptTrustDetails in the Details section of the main report. The main report is grouped by MasterClientID. ...
12
jaccess
by: jaccess | last post by:
Hello all, I am trying to create a running total based on a specific date range that is to be entered into a form. I currently have the form set up with 2 text boxes (date1 and date2) which are...
6
by: Stuart Shay | last post by:
Hello All: I have a array which contains the totals for each month and from this array I want to get a running total for each month decimal month = new decimal; month = 254; (Jan) month =...
3
by: =?Utf-8?B?UGF1bA==?= | last post by:
Hi I have a webform with several entry boxes and the user enters numbers in each box. I keep a running total (just adds all of the entries together) but am posting back to the server to do this. ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.