View Full Version : Stock Control - Query problem


davidod
04-14-2004, 03:38 AM
I am working on a Stock Control Database. The data is held in a number of tables one of which has separate fields to cover the Opening Qty, Additions, Subtractions and Adjustments. This table is accessed through a subform from one of the main forms. Each item is displayed (page at a time) with the subform showing all the transactions for that item. I would like to show the up-to-date stock quantity i.e. the totals from the subform where the stock quantity = Opening Qty + Additions - Subtractions for that item only.

Problem 1: I can’t get to sum all transactions for that individual item only.
Problem 2: Assuming I get that sorted out - where and how do I do the calculations on these totals to get a final balance i.e. opening stock + additions – subtractions for that item.

I except that this might be an involved question but pointers would be appreciated

neileg
04-14-2004, 03:51 AM
The structure of your table is unclear but it sounds like your design is poor. You realy need to normalise your tables. It would be better to have a table that had separate records for each transaction, not fields. If the sign of these records was correct, then you could add a simple total to your subform or run a totals query to generate your current balance.

In addition, you should not be basing your form on the table, but on a query. This way, you can do calculations, apply sorting and all manner of manipulations to your data which you can't do if the form looks directly at the table.