473,799 Members | 3,212 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

MS Access 97 - Decrementing total in a query

1 New Member
First, thanks for having a look at this post.

I am trying to create a query that shows decrementing account balances. It reads the following fields from my tbl/Activity table:
Customer ID, Week #, Activity Date, Account Balance, Amount Charged

I need to export the results of this query to a MS Excel spreadsheet so that I have the following:
Customer ID, Week #, Activity Date, Account Balance, Amount Charged
001, 40, 10/3/2007, 5000, 300
001, 40, 10/4/2007, 4700, 600
001, 40, 10/5/2007, 4100, 100
001, 41, 10/7/2007, 4000, 500
...

Is this possible using a query. I have done queries where I can do math on the same record but this needs to carry along the balance from previous record to the next. I can get this done in a report but then I can't find a way to create the one line per record excel file I want in the end.

Help, suggestions, sample code; any / all are appreciated.
Oct 11 '07 #1
1 1420
nico5038
3,080 Recognized Expert Specialist
First, thanks for having a look at this post.

I am trying to create a query that shows decrementing account balances. It reads the following fields from my tbl/Activity table:
Customer ID, Week #, Activity Date, Account Balance, Amount Charged

I need to export the results of this query to a MS Excel spreadsheet so that I have the following:
Customer ID, Week #, Activity Date, Account Balance, Amount Charged
001, 40, 10/3/2007, 5000, 300
001, 40, 10/4/2007, 4700, 600
001, 40, 10/5/2007, 4100, 100
001, 41, 10/7/2007, 4000, 500
...

Is this possible using a query. I have done queries where I can do math on the same record but this needs to carry along the balance from previous record to the next. I can get this done in a report but then I can't find a way to create the one line per record excel file I want in the end.

Help, suggestions, sample code; any / all are appreciated.

You can do so by using the DSUM() and DMin() function to total the Charged and subtract that from the DMin(Balance) as you need to have a starting balance somewhere....
It's however slowing down the query and I wouldn't do this in Access, but using a formula in Excel after the export.

Nic;o)
Oct 12 '07 #2

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

Similar topics

14
5423
by: Sean C. | last post by:
Helpful folks, Most of my previous experience with DB2 was on s390 mainframe systems and the optimizer on this platform always seemed very predictable and consistent. Since moving to a WinNT/UDB 7.2 environment, the choices the optimizer makes often seem flaky. But this last example really floored me. I was hoping someone could explain why I get worse response time when the optimizer uses two indexes, than when it uses one. Some context:
4
8519
by: Sondra Wilson | last post by:
I have created a sorted query. The total(records) I get in the query is correct. My problem lies with getting that total into my report. I use count to insert the total number of records in my datasheet.(That's fine) My report also needs the number of records from the query. When I use "Count", I get the whole datasheet and not just the "sorted query". Is there any way to get the number that I need? Any help is appreciated. Thank you.
2
1356
by: Kailey11 | last post by:
This probably is a basic question for most of you, but I am setting up an very simple database - person, date traveled, location and milage - using ACCESS 2000 and I want to add up the milage in one field so when I do a query on each person I can print out a report giving their total milage for the time period. I have been pulling out my hair over this one. Any help MUCH appreciated!! My books on ACCESS 97 don't seem to address this. I...
0
1874
by: jphelan | last post by:
I have a subform that works fine until you import it into a new database when it crashes if you try to open it in either disign or form view. The form, "Attendees_Subform" in my application was pattern after the same form used in the MS template, "Event Management.mdb" application that is downloaded from the MS Template Gallery on their website. I narrowed down the problem to the Control Source in the, "Attendees_Subform using the...
1
5166
by: Brad | last post by:
Thanks for taking the time to read my question. I have a table of data that has Date, Data and Category. I need to show, in a report, each Categories Data by Date. The Date has to be it's own column across the top and Category down the left side. As data is entered, the number of unique dates increases. As a result the
25
6785
by: Shannon Jacobs | last post by:
The OL tag still allows for a START value, but that is now deprecated. I've found sound references that suggest the proper technique now is to control it with a style for the OL in quetion, but I haven't been able to find the proper reference. What I actually want is an ordered list that counts down to one. Are negative increments even possible? Doesn't seem like a ridiculous idea in the real world, but... (Yes, I also searched these...
13
2128
by: Ulv | last post by:
I have a table (TblItems) with fields Lenght, Width and Height as decimalfields. I also have the fields Desc, a text field. In a form I have created this line of code after updating: Desc = Lenght & " x " & Width & " x " & Height If the values is 100, 100, 100 the result is 100 x 7920 x 100. No matter what value I put into the width field It comes out with the same 7920. Why??
4
1948
by: pokerboy801 | last post by:
OK, I will try to explain this as clearly and as concise as possible. I am using Access, which has three MS Excel Linked tables, to store call center metrics for reps. My Excel workbook has three separate worksheets, all linked to Access. I have a query that performs some minor calculations, not to hard, and will be ued to drive a report. Here is my problem, I only have about 14 rows of data in each table as we only have three reps. ...
0
7672
MMcCarthy
by: MMcCarthy | last post by:
Rather than using the Access design view change the view to SQL. I am going to attempt to outline the general syntax used for SQL queries in Access. Angle brackets <> are used in place of some syntax elements you must supply. The description of these elements will be in the contained in the angle brackets. Square brackets are used to show which parts are optional. Basic SELECT query SELECT <field list> FROM <table/query name(s)>
0
9687
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9541
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10485
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10252
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9073
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6805
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5585
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4141
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3759
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.