Solved

Count rows in a datagrid

Posted on 2000-05-18
7
309 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
Comment Utility
Use the ApproxCount property.
0
 

Author Comment

by:especht
Comment Utility
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
Comment Utility
Is your datagrid bound, or unbound?
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:especht
Comment Utility
The datagrid is bound.
0
 
LVL 3

Accepted Solution

by:
jrspano earned 30 total points
Comment Utility
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
Comment Utility
Answer accepted
0
 

Author Comment

by:especht
Comment Utility
Thanks for everyone's input.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

772 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

10 Experts available now in Live!

Get 1:1 Help Now