I have a query that produces the following results
Now I need to add some of the values together.I have considered two ways to do this, one is probably gonna get some flack, but I think it may be the easyest option.
1) create an SQL Query that will insert the sum of field (SalesbyHalfPintBottleorCan) where ProductID=1 or ProductID=2 which I came up with the following.
INSERT INTO TblStockFinal (StockLevels)
SELECT (SUM(QrySales1.SalesByHalfPintBottleorCan))
FROM QrySales1
WHERE QrySales1.ProductID=1 OR QrySales1ProductID=2;
I would have numerous SQL's like this that would all be run from a button on an ADMIN form to fill out the table and then create a report form it. the data in the table would be deleted when the report is closed.
I know your not supposed to store calculated data in a table, but I see this as more of a place holder table as opposed to a storage table.
I think that is the easyest option as it can be broken down into multiple parts that are easy to handle.
Option two is to create the report straight off the query.
Either way i still need a query and I am hitting some problems. I was cirtain that you could reference a query result in another query, but I cant seem to get it right, the above query gives a parameter box for you to enter the value for SalesByHalfPintBottleorCan but I want it to sum the values in the column of SalesByHalfPintBottleorCan in the results of the query QrySales1.
I have tried multiple incarnations of the query, with more and less brackets and loads of other little variations and this is just what I gave up on...
Any help would be greatly appreciated