Solved

Running subtraction in Access Db

Posted on 2008-10-28
8
996 Views
Last Modified: 2013-11-29
Hi, all,

I have an inventory database I'm working on, and want to allocate inventory based on ship date.  For example

Part             Date           Qty On Order             Qty On Hand            Adjusted On Hand
ABC           10/30/08               5                                6                              1
DEF           10/30/08               1                                4                              3
ABC           11/5/08                 3                                1                             -2
DEF           11/6/08                 4                                3                             -1

Where the Qty On Hand for oldest shipments is pulling from an adjusted on hand.  I may have been looking at this too long, and staring an easy answer in the face - but right now I'm stumped...

I appreciate (in advance) any help!

Shauna
0
Comment
Question by:orcas828
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
8 Comments
 
LVL 11

Expert Comment

by:miqrogroove
ID: 22822738
Hi orcas828, what is the question exactly?  Do you need help designing a new table?
0
 

Author Comment

by:orcas828
ID: 22822808
Hi, migrogroove,

Sorry if my question wasn't clear.

I have two linked tables to csv files:  BalOnHand and Orders.  I want to be able to allocate inventory to the orders (in order of age), and reduce the balance of the item for newer orders down the list.  

So, if order #1 needs to ship 10/30, with part ABC, qty 5, and balance on hand as 6, a new column would show an adjusted balance of 1 for that part.  Then, for order #5 that needs to ship 11/5, for part ABC, qty 4, I'd show a -3 in the adjusted balance.

I'm not sure what I'd need to do to make that happen.

Hopefully, I've explained my question a little better!
0
 

Author Comment

by:orcas828
ID: 22822818
Kinda like a reverse DSUM (only subtracting for each part, instead of adding...)
0
Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

 
LVL 11

Expert Comment

by:miqrogroove
ID: 22822856
Okay so you just need a running sum.  When you say "a new column would show an adjusted balance of 1 for that part" does that mean it must be calculated and stored in a table?  Or do you only need the running sum to appear in a report?
0
 

Author Comment

by:orcas828
ID: 22822870
At this point, I only need it to show in a report.
0
 
LVL 11

Expert Comment

by:miqrogroove
ID: 22822946
Excellent.  That will give you a lot of flexibility and a simple answer:

Create a report that has the Qty field listed twice.  One of the two instances will become the running sum or balance column.  In the properties for that field, look at the Data tab and you will see a Running Sum property.  Set this property to "Over All" or as appropriate.  This will give you a running sum of that column in the report output.

Depending on the circumstances, you might need a starting quantity or "balance forward" row in the underlying data.  This can be accomplished with a relatively simple union query.
0
 

Author Comment

by:orcas828
ID: 22822967
Will the running sum do a running subtract, though?
0
 
LVL 11

Accepted Solution

by:
miqrogroove earned 500 total points
ID: 22823054
Yes I think one of the nuances here is that you want to display a positive quantity ordered but have a negative running sum.  So for simplicity this report should be based on a query that has the qty ordered column also listed twice.  In the Field row of the query's design view for one of the two columns, enter something like:

QtyChange: -[QtyOrdered]

Now if you set the data source for the 'running sum' field to QtyChange instead of QtyOrdered you will get a negative running sum.

If you are adding to your inventory by receiving shipments then you will want to consider where and how that gets represented.  Ideally you want to end up with a QtyChange column that can make an elegant running sum, even if it is necessary to do a union between orders and receiving.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…

710 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question