happy new year to everyone
what i am trying to do is when i enter a number in the yellow box called update it will remove that amount from the stock qty and it also did from the allocation but i am trying to change it so that if the allocation is less than the value i put into the update field then just make the allocation filed blank or 0
so the example below i would like to see 5 left in stock and 0 in allocation not -5 but if i had put 10 in the update field i would want to see 20 in stock and 10 in allocation
but i am not managing to get the if statement etc correct
thanks steve
what i am trying to do is when i enter a number in the yellow box called update it will remove that amount from the stock qty and it also did from the allocation but i am trying to change it so that if the allocation is less than the value i put into the update field then just make the allocation filed blank or 0
so the example below i would like to see 5 left in stock and 0 in allocation not -5 but if i had put 10 in the update field i would want to see 20 in stock and 10 in allocation
but i am not managing to get the if statement etc correct
thanks 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.Update = ""
36 Else
40 Me.allocation = Me.allocation - Me.Update
50 Me.Update = ""
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