SOLVED Simple VBA calculation
Hi all,
I have a simple math problem.
I am trying to automatically calculate the value of a couple fields.
It is a very simple equation:
txtStockEOS1 = txtStockSOS1.value + txtStockReceive1.value - txtStockLost1.value - txtStockBroken1.value - txtStockWorn1.value
I.e., 10 = 5+8-1-1-1
I get a run-time error 13: type mismatch when I enter a value in one of my fields whilst testing. This is my code:
Code:
Private Sub txtStockSOS1_Change()
Me.txtStockEOS1 = CDbl(txtStockSOS1.Value) + CDbl(txtStockReceive1.Value) - CDbl(txtStockLost1.Value) - CDbl(txtStockBroken1.Value) - CDbl(txtStockWorn1.Value)
End Sub