Please elaborate a bit. Is this a multiuser db? What is the Recordset based on? Are you deleting records within the Loop? Could you post some of the code, commenting on where the err occurs?
MichaelRed
mred@duvallgroup.com
There is never time to do it right but there is always time to do it over
Well my code is a bit complicated as the error occurs when I am filling a treeview object.
It is a multiuser database, and I am not deleting records in the code, but I use the recordset of the form where the treeview object is located, and this is where the deletion is taking place.
So far I have solved the problem using errortrapping, with a function where I check for a value in the record. But I am sure there is a better way to check if a record is deleted?
Here is the function:
Private Function isrecorddeleted(xvar As Field) As Boolean
On Error GoTo errorhandling
dummy = xvar.Value 'to trigger error if deleted
isrecorddeleted = False
Exit Function
errorhandling:
If Err.Number = 3167 Then
isrecorddeleted = True
Else
MsgBox "An error occured: error:" & Err.Number
End If
End Function
Getting the error "record deleted" occurs when/where you create a recordset (dynaset) and delete records which you then 'traverse'. In my experience, I usually would use the source (your treeview) and set it up to only show records which i wanted to operate on. If the operation was to 'delete' the records, I would just collect them in a 'batch' and do a delete query on the whole (enchalida). I would not normally set up a user accessible control to select records for different manipulation, and thus don't see the record deleted err. I do not know any specifics of your app, but I suspect that you are using the treeview to do different operations on records without refreshing the underlying recordset. Thus "deleted" records remain in the recordset and your app traverses the recordset, triggering the error. If this is the situation, I don't know of a soloution other than your error trapping or refreshing the recordset after the operations (especially the delete).
MichaelRed
mred@duvallgroup.com
There is never time to do it right but there is always time to do it over
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.