473,395 Members | 1,466 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.

How to sum multiple occurences of same item number.

ajhayes
I posted a few weeks ago about trying to set up a way to order by unit number (http://bytes.com/topic/access/answer...-ordering-unit)

I'm trying to use a similar structure to what OldBirdman suggested in my previous post, but I'm a bit stuck.

Here is what I've set up:

tbl_Orders
Order_Number
Order_Date

tbl_Units_Ordered
Order_Number
Unit_Number
Qty_of_Units

tbl_Inventory_Items_in_Unit
Unit_Number
Item_Number
Qty_Per_Unit

I have a query that uses tbl_Units_Ordered and tbl_Inventory_Items_in_Unit:
Unit_Number
Qty_of_Units
Item_Number
Qty_per_Unit
= [qty_of_units]*[qty_per_unit]

My problem now is that most of the poletop units are made up of some combination of the same parts. So, my query is getting a total of each item per unit number, but I ultimately need to sum the total number of each item across all unit numbers. For example, as you can see below, there is a part number 285-073-39292 in an A1 as well as in an A3.)

Expand|Select|Wrap|Line Numbers
  1. Unit_Number    Qty_of_Units    Item_Number    Qty_per_Unit    Total_Qty
  2. a1    1    285-073-39292    1    1
  3. a1    1    285-073-32359    1    1
  4. a1    1    285-073-32369    1    1
  5. a3    3    285-073-39292    1    3
  6. a3    3    285-073-32359    1    3
  7. a3    3    285-073-32369    1    3
  8. a3    3    285-073-43378    1    3
  9. a3    3    285-073-16377    1    3
  10. a3    3    285-073-32678    1    3
  11. a3    3    285-073-15659    1    3
How do I go about summing the quantity for all occurences of the same part number? Or is this plan completely flawed to begin with? I am very much a novice at this, and I'm beginning to feel like I've bitten off more than I can chew with this project!
Mar 3 '09 #1
1 4101
PianoMan64
374 Expert 256MB
@ajhayes

My simple suggestion would be to simply go into a blank query. Select the main table that your data is coming from.

at the top of the query designer you'll see a greek letter for Sum (it is a backwards 3.) When you point to it it will say total.

When you click that, it will put a new line in the query builder that says GROUP BY.

The Group BY option allows you to group items when that particular value changes. If you want to SUM a value, then simply change the GROUP BY option to SUM. Then those value will the be summed for all items that are grouped.

and so on.

If you have a calculation that you want to do on these groups, then you would change the GROUP BY to EXPRESSION. then that allows you to put a formula as a calculated field.

I hope that helps,

Joe P.
Mar 5 '09 #2

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

Similar topics

17
by: Andrae Muys | last post by:
Found myself needing serialised access to a shared generator from multiple threads. Came up with the following def serialise(gen): lock = threading.Lock() while 1: lock.acquire() try: next...
6
by: Ben Hallert | last post by:
Hi guys, I'm trying to figure out what bone headed mistake I made on something I put together. I've got a form (named 'context') that has a variable number of select-multiple inputs on it. ...
4
by: Dave Edwards | last post by:
I understand that I can fill a datagrid with multiple queries, but I cannot figure out how to fill a dataset with the same query but run against multiple SQL servers, the query , table structure...
4
by: Vinit | last post by:
Hello, I have an xml file with the following snippet: ....... some tags <ListItems> <item> 1 </item> <item> 2 </item> <item> 3 </item> </ListItems>
8
by: Daneel | last post by:
Hello! I'm looking for an algorithm which finds all occurences of a bit sequence (e.g., "0001") in a file. This sequence can start at any bit in the file (it is not byte aligned). I have some...
3
by: Gilles Ganault | last post by:
Hello I'd like to make sure there isn't an easier way to extract all the occurences found with re.finditer: ======================= req = urllib2.Request(url, None, headers) response =...
18
by: Neehar | last post by:
Hello For one of the interviews I took recently, I was given an offline programming quiz. In 30 minutes I had to write code in C++ to counts the number of times each unique word appears in a...
4
by: Nick Vargish | last post by:
Hi, I'm a little bit stuck trying to send a SOAP request that includes multiple occurrences of an element. For the sake of illustration, this is what the relevant portions of the SOAP request...
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
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
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
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
tracyyun
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...

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.