Add record count

  • Thread starter Thread starter Stapes
  • Start date Start date
S

Stapes

Hi

I have removed the navigation buttons from the foot of my form and
replaced them with 'Next' and 'Previous' buttons.
However, the record count information that comes with the Navigation
buttons is very useful.
Is there any way I can get this information.

Stapes
 
Hi

I have removed the navigation buttons from the foot of my form and
replaced them with 'Next' and 'Previous' buttons.
However, the record count information that comes with the Navigation
buttons is very useful.
Is there any way I can get this information.

Stapes

=ThisRecord() and =Count("*") in the recourdsource of a textbox
 
You could try something like this in the form's Current event. txtCounter
is an unbound text box.

Dim lngCurrent As Long, lngTotal As Long
Dim strOf As String

lngCurrent = Me.CurrentRecord
Me.RecordsetClone.MoveLast
lngTotal = Me.Recordset.RecordCount
Me.txtCounter = lngCurrent & " of " & lngTotal

ThisRecord seems to be a custom function. If you do not have the function
in your database you will get an error message. I assume the error message
was something about a user-defined something not defined (it helps to post
the text of an error message).
 
I just realized that strOf is unnecessary in the code I posted. The code I
posted is in a module; strOf is a leftover from that. I use a module
because the same code can be used for any form, and the module can be copied
to another database.
 

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

Back
Top