Skip to content
Advertisement

MS-Access: Calculate Stock From 3 Tables

I was reading this post from StackOverFlow to adjust query to calculate stock from 3 tables. I have 3 tables tblItems, tblPurchase and tblSales. tblItems contains items information like below.

Screenshots of my tables

tblItems:

enter image description here

tblPurchase:

enter image description here

tblSales:

enter image description here

And my expected result like below

enter image description here

In query result items details will come from tblItems. Sum purchase quantity per item and sum sales quantity per item then minus SalesQuantity from PurchaseQuantity to see stock.

Here is my query which gives me following warning.

enter image description here

Seeking help to resolve the warning and get my expected output. Any help is greatly appreciated. Thanks in advance.

Advertisement

Answer

You don’t need the outer/first group. Since your item table will [probably] will never have duplicate items the records returned will always be unique.

the both left joins you are using is grouping by itemCode so they also will only return one record per item. so grouping overall is not required.

this could work for you:

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement