Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Deleting records using ADO.

Status
Not open for further replies.

logo

Programmer
Aug 22, 2001
56
US
I am trying to delete a recordset in ACCESS 2000 using the ADODC component in VB 6.0.

I first began by coding: adodc.recordset.delete

This allowed me to delete the record, but when I attempt to navigate through the recordset AFTER deleting I get an error stating that a "row handle is marked for deletion."

So then I coded: adodc.recordset.delete
adodc.recordset.refresh

Again, the record is deleted, but when I attempt to navigate the recordset I receive the error "operation was canceled."

I have tried several combinations for changing the lock attributes and using refresh, requery, or neither, but cannot seem to get around these errors...Any ideas? Does anyone out there know what I am missing here ??



 
Have you tried something like this:

With Adodc1.Recordset
.Delete
.MoveNext
If .EOF Then .MoveLast
End With

You shouldn't need refresh or requery after a delete, that only reopens the database and updates the recordset for multi-users or to add child records to a newly added parent record.

The error you're getting suggests you may also need to CommitTransaction or RollBackTransaction (if disconnected recordset or other configuration). Are you using adLockOptimistic? Something else to try anyways.

Hope that helps.

-Mike Difference between a madman and a genius:
A madman uses his genius destructively,
A genius uses his madness constructively.
 
Not sure if I'm talking rubbish here, but you may not need the .MoveNext in the above example. I seem to remember that deleting a record automatically move the cursor.

Chaz
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top