Hi,
I know there are lots of answers provided on here regarding running total, however, I have not seen the specific answer to what I need for my database.
Now, I have a database built in access 2013. In my database, I have two tables (tblTransaction and tblStockCard).
The tblTransaction table holds all the +- transactions while the tblStockCard holds the list of items in stock with their opening balances. The tblTransaction table has columns as listed below: -
StockID ransDate QtyIn QtyOut
-
1 5/2/2019 60 0
-
2 5/3/2019 300 0
-
1 5/4/3019 500 0
-
2 5/4/3019 0 150
-
1 5/4/3019 0 50
-
1 5/5/3019 0 200
-
2 5/6/3019 125 0
-
Now, I have developed a query to look like this: -
StockID BeginningBalance TransDate QtyIn QtyOut RunTot
-
1 500 5/2/2019 60 0 560
-
1 500 5/4/3019 500 0 1060
-
1 500 5/4/3019 0 50 1010
-
1 500 5/5/3019 0 200 810
-
2 300 5/3/2019 300 0 600
-
2 300 5/4/3019 0 150 450
-
2 300 5/6/3019 125 0 575
-
Up to now, I have the Runtot giving the results without the BeginningBalanc e using this code: - (SELECT SUM([QtyIn]-[QtyOut]) FROM [tblTransaction] t WHERE t.[TransDate]<= [tblTransaction].[TransDate] AND t.StockID = [tblTransaction].StockID)
-
StockID BeginningBalance TransDate QtyIn QtyOut RunTot
-
1 500 5/2/2019 60 0 560
-
1 500 5/4/3019 500 0 560
-
1 500 5/4/3019 0 50 510
-
1 500 5/5/3019 0 200 310
-
2 300 5/3/2019 300 0 300
-
2 300 5/4/3019 0 150 150
-
2 300 5/6/3019 125 0 275
-
Everytime I add the BeginningBalanc e to the QtyOut and subtracts the QtyOut, it doubles the BeginningBalanc e in the RunTot like this: -
StockID BeginningBalance TransDate QtyIn QtyOut RunTot
-
1 500 5/2/2019 60 0 560
-
1 500 5/4/3019 500 0 1560
-
1 500 5/4/3019 0 50 2010
-
1 500 5/5/3019 0 200 2310
-
2 300 5/3/2019 300 0 600
-
2 300 5/4/3019 0 150 750
-
2 300 5/6/3019 125 0 1175
-
I will appreciate any assistance.
3 1150 twinnyfo 3,653
Recognized Expert Moderator Specialist
I would recommend that rather than having a QtyIn and QtyOut, you simply have Qty. Positive numbers are added, negative numbers are subtracted.
However, because we don’t see your entire query, we don’t know how your re coming up with your initial quantity in your query.
Please post the entire query so we cal take a look at that.
@twinnyfo I thought to just use one column to represent the in and out but I would like to show them in separate columns as double entry. If there is another way to separate the entries into two columns in a query, that will also be helpful. If also the coding can be done in a report, that will also be helpful.
The query is based on the two tables - tblTransaction and tblStockCard and the only code used there is with the runtot which is - (SELECT SUM([QtyIn]-[QtyOut]) FROM [tblTransaction] t WHERE t.[TransDate]<= [tblTransaction].[TransDate] AND t.StockID = [tblTransaction].StockID)
I included only the BeginningBalanc e from the tblStockCard into the query StockTransactio n.
Or do you mean that I post a demo of the database?
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: fwells11 |
last post by:
Hi there. As you will see from my questions, I am an SQL newb. I
dabble but never get to spend enough time to get proficient so base any
feeedback on that basis please. This is all theoretical information at
this point so I am also going to post this in a MySQL related group. I
will create some designs and post back to the group if I get any
feedback I can use.
Problem:
I would like to be able to keep a running percentage total in...
|
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 that I am having is that sometimes the correct total shows
up in print preview and sometimes it doesn't. Sometimes it is higher
and sometimes it is lower (than the correct amount) and I cannot make
any sense of the difference. The difference...
|
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 for part1, 3 for quantity1,
and 1235 for part2, 8 for quantity2, and on record 2 I enter 1236 for part1,
2 for quantity1, and 1234 for part2, 2 for quantity2, how would I get Access
to spit out a report that says something like this:
Part...
|
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
|
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. There are also several other
subreports in the main report's footer. The rptTrustDetails subreport
has two grouping levels MasterClientID and ClientID, with headers and
footers for each grouping level. In the ClientID footer, I have an...
| |
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 the input for my start and end date, a table (tblALLBCPIC) with a DATE field and ORDPCK field (what I need a running sum of). There are other fields in the table but they shouldn’t matter.
Here is the SQL for my query so far:
SELECT...
|
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 = 78; (Feb)
month = 34; (Mar)
ect ...
|
by: tshad |
last post by:
I am building a GridView that is displaying some money values in 3 columns.
I want to put the totals of each column in a label field (one for each
column) in the footer.
I was trying to figure out which was the faster way or more efficient way.
I originally thought about getting SQL to do it, but that would entail
either a second Select or some type of subquery or self join, which I am not
sure is the best way.
|
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. Is there any way to do it all on
the client side, without posting back to the server? I would like to update
the running total each time the user inputs an amount in a textbox and then
goes to the next textbox.
Thanks,
--
Paul G
Software...
|
by: Vish Narayan |
last post by:
I have a table with four columns :
Autonumber ProductGroup Amount Date
The table consists of transactions for different dates . The dates are already sorted . But I am having a problem in getting the running total for each product group. I need the running total for every date for each product group. When the product group changes then a new running total is required.
Please assist as I have not been able to find a solution so far....
|
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...
| |
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...
|
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...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
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
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |