Ok....

I have an item form with a field called Stock in it. This is the current stock of each particular item.

In my Sale form I have added a subform of my item form as some had suggested this too me.

I click add record choose the item that has been sold from a combo box, i then choose how many are sold and the date of when they were sold.

Then i click save record to keep it. When i press this i want it to update the current stock by subtracting the quantity sold to get a new value.

This is the code i currently have for my Save button

VB Code:
  1. Private Sub save_Click()
  2. Dim stock As Integer
  3.  
  4. stock = stock - Quantity
  5. On Error GoTo Err_save_Click
  6.  
  7.  
  8. DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
  9.  
  10. Exit_save_Click:
  11. Exit Sub
  12.  
  13. Err_save_Click:
  14. MsgBox Err.Description
  15. Resume Exit_save_Click
  16.  
  17. End Sub

But it doesn't work.

I hope this explains my problem.









Edit: Fixed [vbcode][/vbcode] tags. - Hack


Andrew