listbox Count

azhar2006

Registered User.
Local time
Today, 03:11
Joined
Feb 8, 2012
Messages
236
Hi guys
Have a nice day everyone.
I have a listbox based on a query. I want to put a text box on the form that will collect the records in it (ListCount)
 
in the control source of textbox
Code:
= me.YourListBoxName.ListCount
 
in the control source of textbox
Code:
= me.YourListBoxName.ListCount
Thank you very much moke123
I put it in the VBA editor
Code:
Private Sub Form_Current()
'MsgBox "There are " & Me.lstBookings.ListCount & " items in this Listbox."
Me.Text50 = lstBookings.ListCount
End Sub
 
On Current works too.

The difference between the 2 methods is that the Current event will only run once when the form/record changes.
The control source method will update the count if you add an item to the list programmatically.
 
You probably won't be able to use Me in a ControlSource.

I guess it would be more like:
=[YourListBoxName].ListCount
 

Users who are viewing this thread

Back
Top Bottom