I'm trying to get a macro for 1 table to update another table based on the latest entry by the user.
I have 2 tables.
Product(ID, Inventory)
and
Sales(Sales ID, Product ID, Amount)
I created an "After Insert" macro on a Sales table which looked like this
For Each Record In Product
Where [Product].[ID] = 1
Edit Record
Set Field
Name Inventory
Value [Inventory] - 30
What I want to do is that the condition on "Where" should be comparing [Product].[ID] with the [Sales].[Product ID] of the latest entry which triggered the macro and "Set Field" Will update the Inventory with the current value of [Inventory] minus the amount sold on the latest entry.
Can that be done in Access? I've done SQL but it doesn't seem to help here.
Aucun commentaire:
Enregistrer un commentaire