how to check in vba access 2010 in a form if a list box is empty

hi

i have a list box (with the name outputlistbox) that the row source is activated by a recordset and i want that a certain  command button will work only if the list box is not empty and i wrote this code:
 If IsNull(Me.OutPutListbox.RowSource) Or Me.OutPutListbox = "" Then Exit Sub
but the computer allways recognize the list box that it's not empty and it's not exit the sub
why is this?
bill201Asked:
Who is Participating?
 
Rey Obrero (Capricorn1)Commented:

first, what is the RowSource of the listbox? post it here

you can use dcount() to check if rowsource will have records return or open it as recordset.
0
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
Also, you only need this:

 If Me.OutPutListbox = ""

because the RowSource property is a String value, and will never be Null ... only and Empty String  ""

mx
0
 
bill201Author Commented:
yes you are right i can make a dcount
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.