0

I have a list box on a form that is populated by a query. I have set up the list box so that when double clicking on a row, it opens an additional form and populates it based on the row that was clicked on.

I would like to create some sort of error handling for when the a user double-clicks on the list box when it is empty but I am not really sure where to get started.

I was trying something like the below but cleary need further assistance.

If Restructuring_List.Column(0) = Null Then
MsgBox "No restructurings available to modify"
End If
UnbrokenChain
  • 183
  • 1
  • 5
  • 18
  • 1
    [Null is never equal to anything, not even Null. Use the IsNull() function.](http://stackoverflow.com/a/5663965/77335) – HansUp May 01 '15 at 15:39
  • Ah thanks! The below worked : If IsNull(Me.Restructuring_List.Value) Then MsgBox "Nothing" Else – UnbrokenChain May 01 '15 at 15:43

1 Answers1

3

After learning about the IsNull function, the code below works exactly as I want it to. If the query result set is blank and the user double clicks in the list box, the message appears. If the result set has records but the user double clicks outside of a record row, the message appears.

If IsNull(Me.Restructuring_List.Value) Then
MsgBox "Nothing"
Else
UnbrokenChain
  • 183
  • 1
  • 5
  • 18