473,387 Members | 1,863 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

How to display the number of rows in a table?

I am developing an Access application using Access 2010 running under Windows 7. The database has some large tables containing many thousands of rows. I want to display the number of rows in these tables in a form.

I have tried a couple of methods to do this, both of which work fine except that they take several seconds to run. One method is to use DCount; the other method is to create a recordset and access its RecordCount property. I'd welcome any suggestions for a faster way to do this.

When I open a table interactively, the number of rows is immediately displayed. It seems that Access keeps track of the number of rows in a table and that there is probably a way to access that number without writing code to rediscover it. I've hunted, without success, to access this number.

Gordon
Nov 18 '10 #1
2 4760
Mariostg
332 100+
Maybe it would be faster if instead of using the RecordCount method, you include your record count in the sql statement such as SELECT COUNT(aField) as rowCount FROM BigTable. Then you retreive rowCount. I would certainly be curious to know which one is faster.
Nov 18 '10 #2
NeoPa
32,556 Expert Mod 16PB
I think this may be a simple case of mis-memory Gordon. Access tables when opened, will show the number of records almost immediately only when this can be determined pretty quickly. There are a number of cases where a noticeable delay occurs with the value empty, before it is updated to reflect the actual count. Linked, and particularly remote, tables suffer from this much more than local ones generally, but there is no magically stored value associated with the table that can easily be used.

This question has come up before, and the recommendation is to access the last record before requesting the count. This has the effect that the buffer will be populated to a greater extent (not the full table necessarily), so this is a benefit if users intend to move around the recordset within the form. If that is not likely to be a benefit then a DCount() call may well suit your purposes as well.

NB. The RecordCount property will return a value (if called) even before the extent of the recordset is known, so beware of relying on such a value until after a call to go to the end (MoveLast).
Nov 18 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Martin Ernst | last post by:
Hello, i have a table with two rows: <TABLE> <TR> <TD ROWSPAN="2"> <IMG SRC="pics/image.jpg" width="575" height="???"> </TD> </TR>
1
by: Roderik | last post by:
Hi, I have a table like this: <table id="myTable"> <tr><td>text</td><td>text</td></tr> <tr><td>text</td><td>text</td></tr> ... <tr><td>text</td><td>text</td></tr> </table>
0
by: VM | last post by:
After I do DataTable.Select() on my table, how can I display these rows in my datagrid? I cannot use a dataview because these selected rows will be altered. For example, if my query returns 1 row...
2
by: ameshkin | last post by:
I know this is probably not too hard to do, but how do I display multiple rows of a mysql query/recordset. Im having trouble doing this. I don't just want to display them, but I want to make sure...
10
by: obrienkev | last post by:
Hi all, How do I display multiple database rows in the one textBox? The textBox is bound to the Database table and should display 3 database values. However it displays only one. How do I...
1
by: sharadadutt1981 | last post by:
hi all, I was trying to fetch even or odd number rows from database. currently i am usying DB2 ver 8.0. any one can help me out.
1
by: clickingwires | last post by:
How do you consecutively number rows in an aggregate query?
8
by: JVG | last post by:
hi, i am create complaint register in Ms- Access 2000 ther is i want complaint no. which is depend on month and year. for Eg. if the month is Janury and year is 2007 then my complaint number is...
2
by: davidson1 | last post by:
Hai friends, To display skeleton of table we have in oracle desc student; name char(200) age number(10) In SQLSERVER do we have any command to display skeleton of table...
1
by: Rohan S | last post by:
Hi, I want a help in sql server 2005 as mentioned below: I want to select rows on top from a table which has more repeated values in a column. For Example: pEnt_ID ShortName FundID ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.