Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Undoing Changes in Subform 1

Status
Not open for further replies.

jaydy

MIS
Nov 9, 2003
27
PH
Hi,

I'm currently doing an invoice database. So I have one subform in my invoice form that basically lists all the orders. Each row has the fiels product, quantity and the total amount. My problem here is, I've created a code that after you update the quantity, it automatically deducts from the warehouse that product is located in. But, if the user suddenly changes her mind and decides to change the quantity like for example it was originally 5 then she changes it to 2, instead of adding 3 more to my inventory it just deducts 2 more.

How can i resolve this?

Your suggestions are most welcome.
 
You don't want to decrement the quantity from inventory you want to decrement the change in quantity.

To start, in the Current event in the subform, store the quantity in a variable - say intPrevQty. Then after the quantity gets updated, calulate the change in quantity as (current quantity - intPrevQty). Use that value to update the inventory.

Note that if you update the inventory before the subform record is saved, you could use the OldValue property of the Quantity control rather than saving the old value in a separate variable.
 
Thanks, I used the old value property and now it works. Thanks a lot
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top