Display number of records

P

Pyrite

I have a form based on a query, I want to have abox that displays the number
of records and the number of the current record. Much the same as the
'Navigation Buttons' option being set to yes for the form. I dont want it to
be the navigation buttons though as they look unsightly and I already have
nav buttons within the form so I literally need a way of displaying '1 of x'
so that a user knows how many records have been returned by the quesry and at
which number they are currently looking.

Thanks in advance.
 
B

BruceM

You could have something like this in the form's Current event:

Dim lngCurrent As Long, lngTotal As Long
Dim strCounter as String

lngCurrent = Me.CurrentRecord
Me.RecordsetClone.MoveLast
lngTotal = Me.RecordsetClone.RecordCount

strCounter = lngCurrent & " of " & lngTotal & " records"

Me.txtCounter = strCounter

txtCounter is an unbound text box on the form.

For a more sophisticated approach, which has the added advantage of being
reusable in all of your databases and forms:
http://www.lebans.com/recnavbuttons.htm
 

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

Top