Row handle referred to a deleted row or  row marked for deletion

Posted on 2014-08-18
Last Modified: 2014-08-19
I have code in vb6 where I am trying to add the column for a total.  After I make a deletion, I get the posted error:

"Row handle referred to a deleted row or  row marked for deletion"  The error happens on line 5

Why does this happen?

Private Sub DataGrid2_AfterDelete()

SumTotal = 0
Do Until rec2.EOF = True
   SumTotal = SumTotal + rec2("GrossAmount")
GrossTotal = SumTotal

SumTotal = 0
Do Until rec2.EOF = True
   SumTotal = SumTotal + rec2("NetAmount")
NetTotal = SumTotal

End Sub

Open in new window

Question by:al4629740
    LVL 15

    Accepted Solution

    After deleting a record from a DataGrid control, you should use the Refresh method on it to force the DataGrid to update. Otherwise, although a record has been deleted from the underlying recordset, the record will still show in the DataGrid.
    Note: To preserve Column Buttons you must invoke the HoldFields method in InitGrid Function.

    Author Comment

    Would I put a rec2.update before line 3?

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    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

    I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
    Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
    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…
    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…

    761 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

    9 Experts available now in Live!

    Get 1:1 Help Now