I wish to write a query that gives me the stock balance.
In my DB, I have a table Named "TblStock" and "TblStock2"
In these tables, I store data concerning products including; Purchases, Sales, Transfer inward, Transfer outward. Each of these elements is differentiated in the table TblStock under the Field "Nature" by
SA = Sales
PH = Purchases
TI = Transfer Inward
TW = Transfer Outward
Now I wish to know the balance of each stock item using the formula:
Available Stock = Purchases - Sales +Transfer Inward - Transfer Outward
To this effect I have created queries to sum up each item and finally, I have created a query named: " Available Stock"
This query uses the other queries i created to calculate the available stock.
The problem i have here is that available stock only appears for a stock item that is available in Purchases, sales, Transfer inward and Transfer outward.
Now what i want is that when a stock item does not exist in either Sales or Transfer inward for example, it should return a zero (0) so that available stock should be calculated using the zero (0).
Attached is the part of my DB
AvailableStock.zip