Nothing can ever be compared to Null, even to another Null. And nothing is ever compared to Null, even to another Null.
When Bank_Credit is Null, the following expression returns Null ... not True , as you might expect, or even False .
Debug.Print (Me.Bank_Credit.Value = Null)
This is the same reason for this result in the Immediate window:
Debug.Print Null = Null Null
Use the IsNull() function.
If IsNull(Me.Bank_Credit.Value) Then
Also, see the Nz() help section to see if it can be useful. You can do this, although this is really not an improvement over IsNull() . But Nz() can be very convenient for other VBA code.
Me.Bank_Credit = Nz(Me.Bank_Credit, 0)
Hansup
source share