List Box

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello all, and thanks IA for the help.

I have a list box that is populated by a query. Is there a way check the
list box to see if it "Is Not Null"?

Or, is there a way to have the query populate the list box and allow me to
check and see if it contains any data?

I don't want to have to run the query twice to obtain this info.
 
Mark,

If I'm reading thru the lines correctly, I understand that by "listbiox
not being null", as you put it, you mean listbox having at least one
row, vs. none?

Well, the answer is yes, but this is as general as the question. Pls
provide some details of your situation, so you get specific help: what
exactly, are you trying to accomplish? In what context? Form and listbox
names?

Nikos
 
Thanks for responding Nikos.

What I have is a form that has a listboxes that shows a error queries. I
have the listbox refreshing with a timer event. What I want to do is have a
message box, or something to let me know that we have an error (query returns
some data).

Private Sub Form_Timer()
lsWaitErr.Requery

And wanting some whay to check and see if it contains data. Someting like
this:

if lsWaitErr Is Not Null Then
msgbox "Help"
end if

Quote :If I'm reading thru the lines correctly, I understand that by
"listbiox
not being null", as you put it, you mean listbox having at least one
row, vs. none?

Yes.
 
Mark,

All you need is this:

Private Sub Form_Timer()
Dim cnt As Integer
lsWaitErr.Requery
cnt = Me.lsWaitErr.ListCount
If cnt >= 1 Then
MsgBox cnt & " errors found.", vbEcxlamation, "Attention!"
End If
End Sub

HTH,
Nikos
 
Back
Top