Hi everyone, I hope you are all keeping safe out there!
For an unknown (to me) reason, the following VBA code has stopped working as it should.
In a nutshell: the value of txtLocatStock is prepopulated. If the figure entered manually in to txtNewQty is greater than txtLocatStock, it should say "You are adding *the difference* to this location".
Alternatively, if the entered amount is Less than txtLocatStock, then it should say that you are "deleting" from this location.
The "less than" option works fine, however the "more than" option simply doesn't work and the message the user gets is: "You are deleting -"x" from this location"; where X is the difference value.
As it happens, deducting a negative does provide the correct result, but I need the wording to be correct for the user as it is understandably causing confusion.
This has worked fine before and I just cant work out why it has stopped now!
Many thanks for all your help!
Chris
For an unknown (to me) reason, the following VBA code has stopped working as it should.
Code:
Private Sub txtNewQty_AfterUpdate()
If Me.txtNewQty < Me.txtLocatStock Then
Me.txtTransactionInfo.Value = "You are deleting " & Me.txtLocatStock - Me.txtNewQty & " from this location"
Me.txtStockAdjustmentType.Value = "Stock Loss"
Me.txtTransactionQty.Value = 0 - (Me.txtLocatStock - Me.txtNewQty)
Else
Me.txtTransactionInfo.Value = "You are adding " & Me.txtNewQty - Me.txtLocatStock & " to this location"
Me.txtStockAdjustmentType.Value = "Stock Gain"
Me.txtTransactionQty.Value = Me.txtNewQty - Me.txtLocatStock
End If
End Sub
In a nutshell: the value of txtLocatStock is prepopulated. If the figure entered manually in to txtNewQty is greater than txtLocatStock, it should say "You are adding *the difference* to this location".
Alternatively, if the entered amount is Less than txtLocatStock, then it should say that you are "deleting" from this location.
The "less than" option works fine, however the "more than" option simply doesn't work and the message the user gets is: "You are deleting -"x" from this location"; where X is the difference value.
As it happens, deducting a negative does provide the correct result, but I need the wording to be correct for the user as it is understandably causing confusion.
This has worked fine before and I just cant work out why it has stopped now!
Many thanks for all your help!
Chris