[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


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

Posted on 2014-08-18
Medium Priority
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

eemit earned 1500 total points
ID: 40269867
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

ID: 40270972
Would I put a rec2.update before line 3?

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
Suggested Courses
Course of the Month20 days, 1 hour left to enroll

873 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