counting the list box

  • Thread starter Thread starter JohnE
  • Start date Start date
J

JohnE

I have a form and on it has a list box (list1) and a
combobox (combo1) that shows the years. When I select the
year, the list box displays the claims for the year
selected in the combo box. What I would like to do is use
a label (or textbox) and show how many items there are in
the listbox for the selected year. And I'm stumped.
Anyone have thoughts on this?
Thanks for the help.
*** John
 
This should be easy to use... just set the control source or value to this..
you will need to edit it a bit

DCount ("[YearFieldName]","tablename","[YearFieldName]=" & [SelectedYear])

-Kevin
 
JohnE said:
I have a form and on it has a list box (list1) and a
combobox (combo1) that shows the years. When I select the
year, the list box displays the claims for the year
selected in the combo box. What I would like to do is use
a label (or textbox) and show how many items there are in
the listbox for the selected year. And I'm stumped.
Anyone have thoughts on this?
Thanks for the help.
*** John

I guess you either requery the list box or reset its rowsource to get it
to pick up the claims for the specified year. Once you've done that,
the list box control's ListCount property has the number of items in the
list. So you could set a label caption or an unbound text box's value
to List1.ListCount. For example,

Me.lblClaimCount.Caption = List1.ListCount & " claims"
 
Back
Top