We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

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

bill201
bill201 asked
on
Medium Priority
783 Views
Last Modified: 2012-05-11
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?
Comment
Watch Question

CERTIFIED EXPERT
Top Expert 2016
Commented:
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Application Developer
CERTIFIED EXPERT
Top Expert 2007

Commented:
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

Author

Commented:
yes you are right i can make a dcount
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.