Results 1 to 2 of 2
  1. #1
    mike_980 is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jan 2012
    Posts
    58

    Totals queries with multiple product types

    I have had this issue before and could of sworn I fixed it but for some reason it's not working again....


    Part of my database tracks fertiliser stock levels which have the following variables:

    Fertiliser type (let's say type 1, type 2, type 3 etc)
    Fertiliser location (the location at which they are stored)
    Bag weight (the weight of the bags, 500, 600 or 1000Kgs)

    All of the above parameters have their own tables which are related to the tables "tbl_add_fert" and "tbl_remove_fert"

    Whenever fertiliser is added or removed from one of the stores, it is logged into the respective table and a query runs to calculate the new stock level as in theory the stock is always going to be the difference in the two tables.

    I have two primary queries which generate total of each type that has ever been added and total that has ever been removed which both work perfectly when run but my problem is in creating a query that can calculate the difference.

    (Addedd and Removedd are purposefully mis-spelled just so you know, that is not my issue)

    Click image for larger version. 

Name:	1.png 
Views:	7 
Size:	9.3 KB 
ID:	15976


    That is one of the queries that is feeding the secondary query, the other of is the same just with different information.


    Click image for larger version. 

Name:	2.png 
Views:	7 
Size:	23.9 KB 
ID:	15977




    And that is the query that I am having problems with, for some reason, if I remove a bag of a particular type of fertiliser from one store, it removes a bag of every type from every store. Also the Nz isn't working properly as when i run the query when bags have only been added and none removed, the query gives no results.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,632
    You have two queries that summarize tbl_add_fert and tbl_remove_fert records? Is the summation by Fert_type? You have a table of fertilizer types? Join those two queries to the table.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Run multiple reports for multiple asset types
    By cphelps in forum Reports
    Replies: 1
    Last Post: 09-08-2013, 09:01 PM
  2. Replies: 3
    Last Post: 02-26-2013, 05:07 AM
  3. Replies: 5
    Last Post: 12-23-2011, 05:44 PM
  4. Replies: 1
    Last Post: 08-09-2011, 11:13 AM
  5. Replies: 0
    Last Post: 06-07-2007, 02:33 PM

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