Connecting Tech Pros Worldwide Help | Site Map

Record Count

  #1  
Old February 15th, 2006, 05:25 PM
Mike
Guest
 
Posts: n/a
I have a form where I have turned off the default navigation buttons. I
then created my own. This works fine. The only questions that I have is on
the default navigation buttons it shows total records. How can I show this?
I have a text box that shows the current record using:

Text1 = Me.Current

I want to show the total number of records.

How do I do this?

Mike Charney
m charney at dunlap hospital dot org

  #2  
Old February 15th, 2006, 06:55 PM
Cyrille
Guest
 
Posts: n/a

re: Record Count


Hi,

Try this :

Supposing the textbox containing the total number of records is named
txtTotalRecords,
insert this line into the "Current" Event Procedure of your form :

Me.txtTotalRecords.Value = Me.Recordset.RecordCount
that should do the trick ...

Hope it was useful

--
Cyrille

  #3  
Old February 15th, 2006, 07:15 PM
Cyrille
Guest
 
Posts: n/a

re: Record Count


Hi,

Try this :

Supposing the textbox containing the total number of records is named
txtTotalRecords,
insert this line into the "Current" Event Procedure of your form :

Me.txtTotalRecords.Value = Me.Recordset.RecordCount
that should do the trick ...

Hope it was useful

--
Cyrille

  #4  
Old February 15th, 2006, 08:15 PM
Cyrille
Guest
 
Posts: n/a

re: Record Count


Sorry for the double post, I'm posting through Google Groups, and there
must have been a problem with my first posting

  #5  
Old February 16th, 2006, 09:05 AM
Gox
Guest
 
Posts: n/a

re: Record Count


Mike wrote:[color=blue]
> I have a form where I have turned off the default navigation buttons. I
> then created my own. This works fine. The only questions that I have is on
> the default navigation buttons it shows total records. How can I show this?
> I have a text box that shows the current record using:
>
> Text1 = Me.Current
>
> I want to show the total number of records.
>
> How do I do this?
>
> Mike Charney
> m charney at dunlap hospital dot org
>[/color]

Mike,

in Control Source of Text1:

=IIf([CurrentRecord]>(Count(*));'New Record';('Record ' &
[CurrentRecord] & ' of ' & Count(*)))


--
Gox
  #6  
Old February 16th, 2006, 03:15 PM
Ted
Guest
 
Posts: n/a

re: Record Count


Use the Bookmark function to mark your current record, perform the
MoveLast to go to the last record in the recordset, grap the record
count, then return to you bookmarked record.
My understanding is that sometimes the recordcount is not accurate
unless you force the recordset to the last record.
I can't remember exactly which user group I read that in of if I got it
from one of the Access User Group meetings I attend at Microsoft in
Redmond, but the most accurate record count is obtained by forcing the
MoveLast to find the last record.

  #7  
Old February 17th, 2006, 05:35 AM
Larry Linson
Guest
 
Posts: n/a

re: Record Count


"Cyrille" <che.public@gmail.com> wrote
[color=blue]
> Sorry for the double post, I'm posting through
> Google Groups, and there must have been a
> problem with my first posting[/color]

If you are going to apologize, do so for not saying that RecordCount gives
you a total number of Records in the Recordset ONLY if you have done a
..MoveLast before displaying the RecordCount. It is a count of number of
Records that have been displayed/ traversed, not a "total".

Larry Linson
Microsoft Access MVP



  #8  
Old February 17th, 2006, 10:15 PM
Cyrille
Guest
 
Posts: n/a

re: Record Count


My mistake, I posted too quickly. It's even indicated in the Help of
Access, so I have no excuses.

The strange thing is, it _seems_ to work. (Of course this can't
constitute a valid justification for using this method, but
nevertheless ...)
I had tested it in a few forms, without the .MoveLast, and the
returned value was always coherent with the number of records (as
indicated in the navigation bar at the bottom). I had tested some
Recordset-related actions, like creating a new record, or deleting one,
and still the value returned by RecordCount (without a prior .MoveLast)
is correct.
So why does RecordCount does report correct values even when all the
records have not been traversed ?
And in which specific circumstances does this method returns false
values ?

The .Movelast - .Recordcount method seems to have a significant
impact on the performance, so is there a quicker and smarter way to
implement a record count ?

--
Cyrille

Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
SQL*Loader - Commit point reached - logical record count 27 Hari Om answers 6 June 27th, 2008 06:09 PM
Datagrid record count Peter W Johnson answers 4 March 28th, 2006 11:25 PM
Can you get the record count inside a repeater control? darrel answers 1 November 18th, 2005 02:22 PM
PHP and MS Access Record Count thomasp@msala.net answers 3 September 11th, 2005 07:05 PM
SQL*Loader - Commit point reached - logical record count 27 Hari Om answers 6 July 19th, 2005 10:05 PM