Results 1 to 5 of 5
  1. #1
    ratcat is offline Novice
    Windows 10 Access 2016
    Join Date
    Mar 2019
    Location
    Rural NSW, Australia
    Posts
    2

    Exclude Column from Total Sum

    Cross-posting. https://www.excelforum.com/access-ta...total-sum.html



    Reason: No responds

    G'day Everyone,

    Uncle Google won't tell me how to exclude (ignore) a column from summing within a query.

    I have 2 tables. One is 'Goods_In', other one is 'Goods_Out'. Through the Access wizard query I have used the 'Find Unmatched Query Wizard' to create a stock on hand queries. This column I'm trying to exclude is the primary key (customlised barcode number) of the query table. Now all I need to do is total the products. But how ?

    Side note: All information is import via excel workbook as I'm dealing with third party inventory as well.

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    What is the SQL of your query? Offhand I'm thinking you either want to change Sum to Group By for that column or delete that column from the query.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    ratcat is offline Novice
    Windows 10 Access 2016
    Join Date
    Mar 2019
    Location
    Rural NSW, Australia
    Posts
    2
    G'day Paul,

    Thank you for your respond. I didn't think to have the product key as 'Sum'. I tried that on a test database and visual its looking like it should, now the fun of double checking.


    I've added the SQL query as you or other forum members may suggest a better way of doing things. Thanks.

    Code:
    SELECT GoodsIn.[Product Key], GoodsIn.Warehouse, GoodsIn.Manufacturing_Date, GoodsIn.Expiration_Date, GoodsIn.Facility_Item_Number, GoodsIn.ThirdParty_Item_Number, GoodsIn.Facility_Item_Description, GoodsIn.Batch_Number, Sum(GoodsIn.Qty_Units) AS SumOfQty_Units, Sum(GoodsIn.Qty_Kgs) AS SumOfQty_Kgs, GoodsIn.StatusFROM GoodsIn LEFT JOIN GoodsOut ON GoodsIn.[Product Key] = GoodsOut.[Product Key]GROUP BY GoodsIn.[Product Key], GoodsIn.Warehouse, GoodsIn.Manufacturing_Date, GoodsIn.Expiration_Date, GoodsIn.Facility_Item_Number, GoodsIn.ThirdParty_Item_Number, GoodsIn.Facility_Item_Description, GoodsIn.Batch_Number, GoodsIn.Status, GoodsOut.[Product Key]
    HAVING (((GoodsOut.[Product Key]) Is Null));

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Glad you got it solved, though I'm confused by the use of the unmatched query. I would expect you to subtract goods out from goods in, but you know your situation best.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Though I suppose if it's a serialized item with a one-to-one relationship between in and out, your query would give you what came in without going out thus ending inventory. I was thinking about quantities not matching.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Formatting the total column of a crosstab
    By keith2511 in forum Queries
    Replies: 4
    Last Post: 11-23-2018, 03:35 PM
  2. Total Column in Query
    By spoolinaz in forum Access
    Replies: 10
    Last Post: 01-03-2014, 12:26 PM
  3. Total from subform column?
    By CyberRaptor in forum Forms
    Replies: 2
    Last Post: 01-17-2013, 05:25 PM
  4. Total Column Calculating Error
    By joannakf in forum Queries
    Replies: 3
    Last Post: 02-10-2012, 11:17 AM
  5. Total of column with check boxes
    By turbosdad in forum Queries
    Replies: 4
    Last Post: 08-07-2010, 07:03 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums