View Full Version : Sum of Qty Query


Bavingtonm
06-29-2009, 02:16 AM
Hi

I'm building a database to record the order of consumables and quantities in stock for each item ordered.
I have created a main Order Form with details of the Supplier, OrderNo, Dates, etc and have a Subform for the Order Details.

The above use 2 seperate tables Ordertab (Order form) and Orddetails (Order details subform), linked via "OrderNo". The 'Orddetails' table has 2 primary keys, OrderNo (same as Ordertab) and ItemID, which links this table to the "Products" table.

When recording an order I use the Order details subform, selecting a Product Code from a combo box (listing all products used) which then uses a DLookup to populate the remaining fields in the subform (ItemID, Description, Cost) resourcing the Products table for the values.

My Problem

I then add a "QTY" and I need this Qty value to be added to the Qty value already stored in the Products table (or an alternative table?) giving me a total stock for this ItemID.
Please could someone advise me of the best way to achieve this function?

Many thanks

Mark

MStef
06-29-2009, 05:02 AM
Hello Mark!
Look at "DEmoQtyA2000.mdb" (attachment, zip).
Open "frmOrder" and try.

Bavingtonm
06-29-2009, 06:55 AM
Hi MStef

Thats exactly what I'm trying to achieve, many thanks!!

Mark

MStef
06-29-2009, 10:26 PM
Hello Marc!
There is one mistake, in VBA, in frmOrderDet,
in Sub Form_AfterDelConfirm change the code.

If Status = 0 Then
DoCmd......
DoCmd.....
DoCmd....
End If