Keeping currentQuantity up to date

W

wj8801

I have two fields currentQuantity and orderQuantity.

currentQuantity holds the current quantity for a particular item

orderQuantity holds the quantity for an order about to be taken

What I'm having trouble with is decrementing the current quantity
after an order is made I think I need to do a dynamic SQL statement
but I'm not sure how, any help would be appreciated.

Thanks



Jase
 
D

Damian S

Hi Jase,

You (generally) never want to store a value that you can calculate. To work
out the currentQuantity, you would do something like
dsum("[incomingQuantity]", "tblItemsReceived", "[ItemID] = " & lngItemID) -
dsum("[orderQuantity]", "tblOrders", "[ItemID] = " & lngItemID)

ie: sum the incoming items, less the sum of those on orders.

Hope that helps.

Damian.
 
Top