Combo Box Null

  • Thread starter Thread starter djf
  • Start date Start date
D

djf

I want the user to get an error message if they do not choose a value in a
combo box. Here's my code, cmbSubGrp is the name of my combo box. What am
doing wrong?

Dim Itm As Variant

If cmbSubGrp.Value = Null Then
Itm = MsgBox("You must select a" & _
" Receiving Group!", 0, "No Selection Made")
Exit Sub
End If
 
djf said:
I want the user to get an error message if they do not choose a value in a
combo box. Here's my code, cmbSubGrp is the name of my combo box. What am
doing wrong?

Dim Itm As Variant

If cmbSubGrp.Value = Null Then
Itm = MsgBox("You must select a" & _
" Receiving Group!", 0, "No Selection Made")
Exit Sub
End If


By definition, nothing is ever equal to Null (because Null represents
"unknown" or "unavailabe" or "not applicable"). Not even Null is equal to
Null.

To solve your problem, use the IsNull function:

If IsNull(cmbSubGrp) Then
 
Back
Top