Determine if listbox is empty

  • Thread starter Thread starter george
  • Start date Start date
G

george

Hi to all and thanks for the support,

I have a list box with family names. When the user clicks
on a name another form opens, FamilyMembers, showing all
the family members. This works fine.

Now I would like to add a button next to the list box with
the following behaviour: If there is even one record in
the list box the button will be inactive. If there are no
records in the list box the button becomes active and
opens the FamilyMembers form to a new record. How can I
count the records in the listbox?

Any help will be greatly appreciated
..
 
george said:
I have a list box with family names. When the user clicks
on a name another form opens, FamilyMembers, showing all
the family members. This works fine.

Now I would like to add a button next to the list box with
the following behaviour: If there is even one record in
the list box the button will be inactive. If there are no
records in the list box the button becomes active and
opens the FamilyMembers form to a new record. How can I
count the records in the listbox?


Use the ListCount property.
 
Marsh
thanks for your reply, can you please give me a simple
example of this property? My list box is on a tab page
thanks george
 
It may depends on the context of what/where you're trying to
do. The general idea is:

If Me.thelistbox.ListCount > 0 Then
'there's something in the list
Else
'the list is empty
End If
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top