Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

record count (record 'x' of 'total)?

Status
Not open for further replies.

NRK

Technical User
Feb 13, 2002
116
US
I am trying to create a record count that displays in a textbox. The format I would like is Record 1 of 20, where '1' is the current record and '20' is the record total. The tricky part for me is that I want this to be based on a query that is populated a listbox.

My current solution is to use txtTotalRecords = listFilter.ListCount, which returns the total records in the listbox.

I have experimented with this, but cannot seem to find a way to count the current record selected. I would appreciate any help that you can provide.

Thank you, in advance.
 
That did help. I really appreciate it!

The text box now displays 0 of 'x', where 'x' is the total. But, regardless of what I do (i.e. select a record or move it), I cannot get the first value ('0') to be anything else.

What I was hoping to do is that if I select the first record, I would see 1 of 'x'. If I selected the third record, I would see 3 of 'x'.

I have the text box running after any change to the listbox, but can you think of anything else it should be?

Here is the augmented code:
txtTotalRecords = (listFilter.ListIndex) + 1 & " of " & listFilter.ListCount
 
In the tetbox, I use...

=[List0].[ListIndex]+1 & " of " & [List0].[ListCount]

U should not have to perform a refresh/requery on the text box, unless u are using sub-forms and such...

Drop a messagebox into the click event of the list to check to see what the values of list index and list count are...

Sounds like u are close... Steve Medvid
"IT Consultant & Web Master"
 
Fantastic! I believe my problem was that I had coded this with a Function, rather than the control source for the text box.

Thank you so much for the quick and awesome help...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top