Count field (1 Viewer)

Matizo

Registered User.
Local time
Today, 15:32
Joined
Oct 12, 2006
Messages
83
Hi,

How do I make a field on a form that shows (counts) the number of records selected on a list box?

Thank You!:eek:
 

John Big Booty

AWF VIP
Local time
Tomorrow, 08:32
Joined
Aug 29, 2005
Messages
8,262
Add an unbound text box to your form an put the following in it's Control Source;
Code:
=[ListBoxName].[ListCount]
 

Matizo

Registered User.
Local time
Today, 15:32
Joined
Oct 12, 2006
Messages
83
Hi John,

Thanks for that. How do I change it so that it shows not the number of all employees in the list box but only the number of selected employees? (This is multiselection listbox).


Cheers
 

Matizo

Registered User.
Local time
Today, 15:32
Joined
Oct 12, 2006
Messages
83
Hi,

yes it works for me too :)

However, I figured out that it will be better to use it as a code:

Code:
Private Sub lstEmployees_AfterUpdate()

   Me.txtCount = Me.lstEmployees.ItemsSelected.Count
 
End Sub

This way I get instant update whenever I select/unselect a record in the box :)

Cheers!
 

boblarson

Smeghead
Local time
Today, 15:32
Joined
Jan 12, 2001
Messages
32,059
I get an instant update using the control source binding method.
 

Users who are viewing this thread

Top Bottom