Does Listbox contain any records?

shacket

Registered User.
Local time
Today, 19:10
Joined
Dec 19, 2000
Messages
218
I have a search form that, when the command button is pressed, updates the SQL statement for a listbox rowsource to display the records found.

If no records are found, I would like to give a message box to say so. Is there a way to dynamically retrieve the number of records in a list box?

Thanks.

Dave
 
Hi Dave

You can use ListCount to get the number of rows in the list box.

I am not quite sure what you want to achive. You may want to consider to open a recordset with the sql you create for the list box prior updating the list box, count the records in the recordset and display a message if appropriate (without updating the list box at all) or updating the list box. Alternatively you could display a message in the list box that there are no records for the criteria (Work-around for the list box SQL for such an instance could look something like this "Select 'No Records Returned For Your Criteria' From AnyTableThatExist_Name").

Hope it helps

Kaspi
 
Thanks. I thought the ListCount property listed how many rows were displayed, not how many existed. That makes what I want to do very easy.

Thanks alot!

Dave
 

Users who are viewing this thread

Back
Top Bottom