1

enter image description here

I want to update the ProductStock field in tblProduct when this query is run. The ProductStock should minus the Quantity field in tblOrderProduct. (ignore the * sign, I just wanted to see if multiplication worked). The user should be prompted to enter the OrderId beforehand

Thanks

asked Nov 1, 2020 at 16:44

1 Answer 1

0

You must specify the condition in a new column where you select the OrderID column. So, in the 3rd column select Table tblOrderProduct and Field OrderID and place [Enter Order ID] on the Criteria line of this column.

Replace the * by -. This will subtract the Quantity from the ProductStock.

Well, and you don't need the Quantity column. Remove it.

In the SQL view you will see

UPDATE tblProduct
INNER JOIN tblOrderProduct ON tblProduct.ProductID = tblOrderProduct.ProductID
SET tblProduct.ProductStock = [ProductStock]-[Quantity]
WHERE (((tblOrderProduct.OrderID)=[Enter Order ID]));
answered Nov 1, 2020 at 16:51

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.