Calculate total number of records

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.
 
N

Nikos Yannacopoulos

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Listbox SEARCH Dev Ashish 4
Dev Ashish Search record count 2
Crosstab query help 1
Access Dcount (multiple criteria) 3
Excel Sumproduct 0
Cumulative totals on a form 10
Abs Function 3
DateDiff on blank fields? 4

Top