I have this code attached to the BeforeUpdate property of an unbound field which is a fixed field set to zero decimals. I want the default for the field to show a zero (0) and have set that property accordingly. The code works properly when inputting anything into the field, but if the user simply tabs or enters thru the default 0, the code doesn't work. If I type 0 in the code works but if I enter thru the default 0 it does not. I take that to mean that the field does not execute the BeforeUpdate routine when the default is accepted without input. Is that what is going on and how can I modify this to work the way I want it to. Having the field default to nothing works, but I'd rather not do that. I want the zero to show.
On a side note, why isn't my code showing up properly in these posts. Am I not using the code brackets properly? Thanks!
Code:
If Me.QuantityProduced > 0 Then
Exit Sub
Else
MsgBox "You Must Enter a Positive Number in Quantity Produced!", vbOKOnly + vbCritical, _
"Positive Quantity Required!"
Cancel = True
Exit Sub
End If
On a side note, why isn't my code showing up properly in these posts. Am I not using the code brackets properly? Thanks!