How to count an Unbound List Box

yus786

I do OK
Local time
Today, 23:15
Joined
Jun 25, 2008
Messages
121
Hi

I have an unbound list box that lists the name of students (from a combo box).

So if i select Class 2 from the combo box - then it lists all the students in this class on the unbound list box

I need to have a count i.e. the total number of students in the class as well.

Any idea how to go about this.

The total can be below the list of students or ANYWHERE on the form.

Thanks
 
how / where / when do you fill the unbound listbox?

Counting should be done at that time.
 
With a textbox on the form named StudentCount

Me.StudentCount = Me.ListboxName.ListCount

If the listbox has a header column

Me.StudentCount = Me.ListboxName.ListCount - 1

As the backwards mailman said, it needs to be done immediately after your code to populate the listbox.
 

Users who are viewing this thread

Back
Top Bottom