Solved

Count rows in a datagrid

Posted on 2000-05-18
7
313 Views
Last Modified: 2013-12-25
How can I count the # of rows in a datagrid?

Thanks,
especht
0
Comment
Question by:especht
7 Comments
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 2821537
Use the ApproxCount property.
0
 

Author Comment

by:especht
ID: 2821824
emoreau,

I tried that and got the following error:

Run-time error '7005':

Rowset not available.

Any thoughts or ideas?

Thanks,
especht
0
 
LVL 32

Expert Comment

by:bhess1
ID: 2822492
Is your datagrid bound, or unbound?
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:especht
ID: 2822642
The datagrid is bound.
0
 
LVL 3

Accepted Solution

by:
jrspano earned 30 total points
ID: 2823281
You have to count after the data grid is filled. If it is in your form load event it might not work because the data grid hasn't loaded yet.  How are you using it?

use something like
dim rowcnt as integer

rowcnt = datagrid1.approxcount


rowcnt will now have the count.
0
 

Author Comment

by:especht
ID: 2873705
Answer accepted
0
 

Author Comment

by:especht
ID: 2873706
Thanks for everyone's input.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question