Search code examples
ms-accesscomboboxvba

access isnull combo value


I am trying to check if there is a value selected for the combo but the true part (no value is selected) is throwing an error stating that: There is an invalid use of the . (dot) or ! operator or invalid parentheses.

If (Len(MinCombo) = 0) Then
    MsgBox "true"
Else
    MsgBox "false"
End If

I have also tried this code but it evaluates to the false part when a value is selected:

If (IsNull(MinCombo) = True) Then
    MsgBox "true"
Else
    MsgBox "false"
End If

I am using MS Access Professional Plus 2010


Solution

  • I went this way:

    Me.MinCombo.SetFocus
    If (Me.MinCombo.selText ="") Then
      MsgBox "true"
    Else
      MsgBox "false"
    End If