Run-time '3167' Record deleted and bookmark problem

fafik1979

New member
Local time
Today, 17:00
Joined
Oct 14, 2008
Messages
7
hi everyone
i need some help with this code:
Private Sub Form_Timer()
Dim table As DAO.Recordset
Set table = Form_overview.RecordsetClone
On Error GoTo errhandler

If table.EOF Or table.BOF = True Then
GoTo end_:
Else
Bookmark_ = table.bookmark

table.MoveLast
b = table.RecordCount
table.MoveFirst

For counter = 1 To b
.
.
.
.
Next counter

End If
table.bookmark = Bookmark_

end_:

table.Close

noerror:
Exit Sub

errhandler:
error_ = Err.Description
'MsgBox Err.Description
DoCmd.SetWarnings False
DoCmd.RunSQL "insert INTO errorhandler VALUES ('" & Now() & "' , '" & error_ & "')"
DoCmd.SetWarnings True
DoCmd.Echo True
On Error Resume Next

End Sub



Private Sub delete_record_Click()
On Error GoTo Err_delete_record_Click

DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdDeleteRecord

Exit_delete_record_Click:
Exit Sub

Err_delete_record_Click:
MsgBox Err.Description
Resume Exit_delete_record_Click

End Sub
problem is that after i delete record or few of them using delete_record_Click() vb is producing error Run-time '3167' Record deleted when i try to save bookmark in Form_Timer(), Bookmark_ = table.bookmark. i have tried to move to next record after deleting and some other things but nothing seems to work. i would appreciate any help with this. on more thing it is Access 2007.

thanks
fafik1979
 
Last edited:
Do you have another means of locating the particular record? Maybe an AutoNumber field? You would be more successful saving a record ID field and doing a .FindFirst to get back to the record. I'm not sure of the validity of a RecordSet.Bookmark after a record has been deleted. I know the bookmark is no longer valid after a Requery.
 
thanks for reply
i think i solved the problem by getting rid of bookmarks :D turned out that i don't actually need them because i don't requery form after form_timer() is finished therefore my screen doesn't go to the first record as i though it would.
thanks for help
 
Excellent! Glad you were able to resolve your issue. Thanks for posting back.
 

Users who are viewing this thread

Back
Top Bottom