Sum by Part Number

  • Thread starter Thread starter Deb
  • Start date Start date
D

Deb

In my inventory table, I have multiple records with the same part number and
sometimes the same part with have a different cost. I need to sum all of the
records for each part number and unit cost. I thought the code below would
work, but it isn't doing the job.

SELECT DISTINCTROW sqry_ViewInventory.PartNo, sqry_ViewInventory.UnitCost,
Sum(sqry_ViewInventory.[Quantity On Hand]) AS [Sum Of Quantity On Hand]
FROM tbl_InventoryListing
GROUP BY sqry_ViewInventory.PartNo, sqry_ViewInventory.UnitCost;

Thanks in advance!
 
but it isn't doing the job.
What ain't it doing or doing it should not?

Maybe dropping out the UnitCost and DISTINCTROW would do it for you.
SELECT sqry_ViewInventory.PartNo, Sum(sqry_ViewInventory.[Quantity On
Hand]) AS [Sum Of Quantity On Hand]
FROM tbl_InventoryListing
GROUP BY sqry_ViewInventory.PartNo;
 
I'm developing a form, selecting the part number from a combo box. The
client may have over 200 of any given part. The parts are listed in a
subform based on the selection from the combo box. I want to display the
total quantity of the selected part by adding the quantity in stock from the
various records together in a box on the form. I've decided to just display
the cost in the subform to keep things simpler.

KARL DEWEY said:
What ain't it doing or doing it should not?

Maybe dropping out the UnitCost and DISTINCTROW would do it for you.
SELECT sqry_ViewInventory.PartNo, Sum(sqry_ViewInventory.[Quantity On
Hand]) AS [Sum Of Quantity On Hand]
FROM tbl_InventoryListing
GROUP BY sqry_ViewInventory.PartNo;
 
Is it working for you now or do you need more assistance?
--
Build a little, test a little.


Deb said:
I'm developing a form, selecting the part number from a combo box. The
client may have over 200 of any given part. The parts are listed in a
subform based on the selection from the combo box. I want to display the
total quantity of the selected part by adding the quantity in stock from the
various records together in a box on the form. I've decided to just display
the cost in the subform to keep things simpler.

KARL DEWEY said:
but it isn't doing the job.
What ain't it doing or doing it should not?

Maybe dropping out the UnitCost and DISTINCTROW would do it for you.
SELECT sqry_ViewInventory.PartNo, Sum(sqry_ViewInventory.[Quantity On
Hand]) AS [Sum Of Quantity On Hand]
FROM tbl_InventoryListing
GROUP BY sqry_ViewInventory.PartNo;
 
Back
Top