Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / General 1 / February 2006

Tip: Looking for answers? Try searching our database.

Record Count

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mike - 15 Feb 2006 17:14 GMT
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
Cyrille - 15 Feb 2006 18:38 GMT
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
Cyrille - 15 Feb 2006 19:01 GMT
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
Cyrille - 15 Feb 2006 20:06 GMT
Sorry for the double post, I'm posting through Google Groups, and there
must have been a problem with my first posting
Larry Linson - 17 Feb 2006 05:23 GMT
> Sorry for the double post, I'm posting through
> Google Groups, and there must have been a
> problem with my first posting

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
Cyrille - 17 Feb 2006 22:04 GMT
  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
Gox - 16 Feb 2006 08:48 GMT
> 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
[quoted text clipped - 9 lines]
> Mike Charney
> m charney at dunlap hospital dot org

Mike,

in Control Source of Text1:

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

--
Gox
Ted - 16 Feb 2006 15:03 GMT
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.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.