We help IT Professionals succeed at work.

invalid row number

al4629740 asked
Last Modified: 2014-08-11
when executing the following code, I get an error from the datagrid:

            esql2 = "select * from tblOrgMonthlyFunds where Inkind = 0"
            rec2.Open (esql2), conn, adOpenDynamic, adLockOptimistic
            rec2!MonthlyID = MonthlyID
            rec2!AgencyID = AgencyID
            rec2!Program = Combo1
            rec2!Description = Text2
            rec2!Inkind = 0
            rec2!GrossAmount = Text3
            rec2!NetAmount = Text4
            rec2!InKindAmount = 0
            Set OrgMR2.DataGrid2.DataSource = rec2
            DataGrid2.Columns(0).Width = 0
            DataGrid2.Columns(1).Width = 0
            DataGrid2.Columns(2).Width = 0
            DataGrid2.Columns(8).Width = 0

Text2 = ""
Text3 = ""
Text4 = ""

SumTotal = 0
For i = 0 To DataGrid2.ApproxCount - 1
SumTotal = SumTotal + DataGrid2.Columns(7).CellValue(DataGrid2.GetBookmark(i))
NetTotal = SumTotal

SumTotal = 0
For i = 0 To DataGrid2.ApproxCount - 1
SumTotal = SumTotal + DataGrid2.Columns(6).CellValue(DataGrid2.GetBookmark(i))
GrossTotal = SumTotal

Open in new window

The error is "invalid row number" and it occurs on line 32

Any ideas why this is happening?
Watch Question

Did you check the value of DataGrid2.GetBookmark(i)) when executing?
I bet that's where teh solution will be


i = 1. During the error.  I don't see where the error is
Top Expert 2012
This one is on us!
(Get your first solution completely free - no credit card required)

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.