473,397 Members | 2,028 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,397 software developers and data experts.

How to create a sum which adds new values to an accumulated sum

Hi,

I am working with an access database. There are 3 columns, The Inventory, The amount to add or subtract from Inventory and The Updated inventory. The updated inventory should display the sum of the other two columns plus its previous accumulated sum but is not doing that because the privous result is not being held or included in the calculation.

For example the inventory is 10, amount to be added is 2, the updated inventory shows 12 which is ok;


however if on a second test the amount to be added is 5 and the inventory is still 10, then the updated inventory shows 15 abd it should be 17 because the last value in the updated inventory was 12 plus 5 is 17. Please help me

AlcaEli
Nov 8 '10 #1
4 2090
NeoPa
32,556 Expert Mod 16PB
I think you need to look again at your design.

The reason you can't get it to work is that your design doesn't makes sense. Your totals shouldn't be stored in individual records.

You may benefit from looking at Database Normalisation and Table structures.
Nov 9 '10 #2
Thanks!!

I believe my design is fine. I think I just need the right function or commands to keep an addition that includes the previous sum.
Nov 9 '10 #3
MMcCarthy
14,534 Expert Mod 8TB
@AlcaEli

Your problem is in your design as NeoPa says. You don't store calculated values in a database. It leads to the very data integrity problems you are having.

There is no formula to do as you describe. It doesn't make any sense.

If I have an inventory of 10 and then I add two why would I keep the value 10? I would just update the value to 12. Then when I add 5 more I would update it to 17. That way I know my inventory stock. I could then query my stock sold against my inventory to find available stock.
Nov 10 '10 #4
NeoPa
32,556 Expert Mod 16PB
AlcaEli:
I believe my design is fine. I think I just need the right function or commands to keep an addition that includes the previous sum.
It's going to be very hard to help you then.

I dare say I have a little more experience than you have in this area, and I'm sure your design will not enable you to do what you want straightforwardly. I'm sure if you apply a little bit of basic logical thinking you'll see why I say what I do.

Good luck anyway.
Nov 10 '10 #5

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

Similar topics

8
by: dmcconkey | last post by:
Hi folks, I have a client with four websites. Each site has a contact form that is identical. They all have "required" fields validated through a JavaScript onSubmit() function. Upon validation,...
3
by: Bari Allen via AccessMonster.com | last post by:
I have a database in a Front-End/Back-End User Environment, which has been running fine, for 4 years. Lately, when the users try to enter data (from a form into a single table) they've been...
1
by: Muhammad Usman | last post by:
hi, I have a table of student which contain four fields that are id(primary key number) , name(text),semester(text)and corse(text), When I insert values in a student table.Explorer Show the...
0
by: Marcelo Henderson via AccessMonster.com | last post by:
I have a table “IGPM”, with three fields: “DATE”, ““ACCUMULATED” , " INDEX”. The date is my primary key, the index stores the IGP of the index of the month, and accumulated it must...
1
by: che2006 | last post by:
Hello, Please I need your suggestions on how to create default values for "Order Details" for each customer in ms access. That is: based on the customer ID, the new record row in the OrderDetails...
6
by: tomerdr | last post by:
Hi, I have the following function and functor and i want to print all values of a map but pair does not support operator << of course. so i wonder what are my options? can i extend the pair...
0
by: steve.lorimer | last post by:
Thank you for taking the time to look at this: I'm looking for a pre-processor command that will allow me to resolve const strings into const char literals at compile time. Looking at the code...
2
by: fabiola1 | last post by:
I'm using Ms Access 2003. I have five tables called tblAllContract tblType tbInteranlContact tblSupplier tblManager The other four tables are linked to tblAllContracts with Id's.I have a...
39
by: howa | last post by:
Hello, What are the default value for initialized variable? e.g. int d; // debug give me -858993460 char c; // debug give me -52
4
by: =?Utf-8?B?SlA=?= | last post by:
I have a C# DLL project I have created. The DLL plugs into other C#.NET applications. This DLL has several classes and methods comprised for 4 namespaces that are used by other programmer to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: 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
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,...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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 projectplanning, coding, testing,...
0
isladogs
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...

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.