Solved

Count rows in a datagrid

Posted on 2000-05-18
7
310 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 69

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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Add a task in Outlook from access 11 35
VBA Shell can't Find Word document 11 74
Modifying Conditional Format from VBA code 3 48
Protecting vb6 & .Net code Obfuscation 18 94
There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

914 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now