empty listbox query

kingsgambit

Registered User.
Local time
Today, 02:30
Joined
May 27, 2001
Messages
134
I have a button on a form which is attached to a query when the query runs it puts the results into the listbox, if the query is nil I would like to have a msgbox say no records found.
I need the vb code to check if there is anything in the listbox and if not run the msgbox, I beleive this can be done with Listcount but I am not sure how to write the code
 
Wouldn't it just be something like:

If Me.lstBox.Listcount = 0 then
msgbox "There are no records to display."
exit sub
end if

I have something like it and that worked for me.

Jennifer
 

Users who are viewing this thread

Back
Top Bottom