Below is a form that changes the stock qty and allocation and stock balance
in the yellow feild which is called update i put the qty i am taking out of the stores in this case 10 so when i have pressed the button " update allocation " this second form below shows that this has happened . this is correct but there was 10 in allocation
the 3rd form shows this time i am going to remove 20 from stock but nothing was allocated this time then in the 4th form you will see the yellow update did not go back to zero and stayed at 20 i have attached the code and have no idea why it will not changed to zero
thanks for your help steve
in the yellow feild which is called update i put the qty i am taking out of the stores in this case 10 so when i have pressed the button " update allocation " this second form below shows that this has happened . this is correct but there was 10 in allocation
the 3rd form shows this time i am going to remove 20 from stock but nothing was allocated this time then in the 4th form you will see the yellow update did not go back to zero and stayed at 20 i have attached the code and have no idea why it will not changed to zero
thanks for your help steve
Code:
Private Sub cmdUpdate_Click()
10 On Error GoTo cmdUpdate_Click_Error
30 Me.StockQTY = Me.StockQTY - Me.Update
35 If Me.Allocation < Me.Update Then
Me.Allocation = 0
36 Else
40 Me.Allocation = Me.Allocation - Me.Update
50 Me.Update = 0
60 Refresh
End If
MsgBox "The selected item in Stocklist has been Updated", vbInformation
100 On Error GoTo 0
110 Exit Sub
cmdUpdate_Click_Error:
160 MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure cmdUpdate_Click, line " & Erl & "."
End Sub