I am trying to write code that greys out a couple of text boxes on one of my forms if certain conditions are not met. I wrote this for the Event OnCurrent for the form. This code isn't working, and I have no idea why.
Code:
Private Sub Form_Current()
If Me.EmployeeNameComboBox = Null Then
Me.BoxRentalAcctCode.Enabled = False
Me.BoxRentalTotalAmt.Enabled = False
End If
End Sub
When I run it, even when I am sure Me.EmployeeNameComboBox is, in fact, Null, it will not execute what is inside the IF statement. It acts as if the IF statement is false, even though it is true. I know this because I put a Watch on Me.EmployeeNameComboBox and I stepped through the code. Even when Me.EmployeeNameComboBox = Null, the code behaves as if that isn't true and skips over the lines inside the IF statement. See screenshot. If I press F8 to step into, it jumps down to End If.
Any idea why this might happen?
EmployeeNameComboBox is part two in a two-part cascading combo box set. I don't know if that matters, but thought I'd mention it.