Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to write "If Listbox has no records, then . ."

Status
Not open for further replies.

dmon000

Technical User
Sep 9, 2003
79
US
Hi All,

I have a listbox, lstOP_History that is populated depending on which query is selected. I want to put a line of code that can detect if there are no records in the listbox as a result of the queries.

I have tried " If me.lstOP_History.recordset Is Null, then"

but I get a runtime error 424, Object Required.

I am not sure if the code I used is the proper code to determine if the listbox is empty.

Please help.

Thanks!!
 
Take a look at the ListBox.ListCount property. From the help file, only available from Macro or VBA code, but it is exactly what you are looking for.

=======================================
People think it must be fun to be a super genius, but they don't realize how hard it is to put up with all the idiots in the world. (Calvin from Calvin And Hobbs)

Robert L. Johnson III
CCNA, CCDA, MCSA, CNA, Net+, A+, CHDP
VB/Access Programmer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top