Calculate total number of records

  • Thread starter Thread starter Vince
  • Start date Start date
V

Vince

How can I calculate the total number of records generated
in a listbox, lstResult? I have provided a text box below
lstResult for the user to view the total number of records.

Thanks.
 
Vince,

First of all, you need to identify the appropriate event to fire the code to
do this for you... It might be Form Load, or a piece of code that changes
the items in the list or... it depends on what you're doing. The rest is
very very sipmle, all it takes is the following line of code:

Forms("FormName").Controls("TextBoxName") =
Froms("FormName").Controls("ListBoxName").ListCount

If the code is run from within the form's module, you coiuld simplify the
syntax to:

Me.TextBoxName = Me.ListBoxName.ListCount

Just make sure to substitute the form and controls names with the actual
ones.

HTH,
Nikos
 
Back
Top