help with list box

  • Thread starter Thread starter Earlmar
  • Start date Start date
E

Earlmar

I want to itemize the records in a listbox..
Is it possible to include a field in a list box that acts
like a counter for the records?
thanks...
 
Earlmar said:
I want to itemize the records in a listbox..
Is it possible to include a field in a list box that acts
like a counter for the records?
thanks...

Not in the list box, but certainly in a textbox right next to it. Use this
function in a Standard Module:

Public Function ListBoxCount(lst As ListBox) As Long

' Purpose: Return the count of items in the list box.
' In: lst - The list box to count items in.
' Out: Integer The count of items in a ListBox
' Created: 3/28/97 - Arvin Meyer

ListBoxCount = lst.ListCount * Abs(Not IsNull(lst.Column(0, 0)))

End Function

Then call it in a textbox passing the name of the listbox:

=ListBoxCount(lstWhatever) & " Items"
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
 
Back
Top