Cannot update database or object is read-only

liborp

New member
Local time
Yesterday, 16:55
Joined
Jun 18, 2008
Messages
7
Hi,
I'm trying remove actual record by this VB code:
Private Sub Command41_Click()
On Error GoTo Err_EditDelBox_Click
Dim rs As Recordset
Dim strBMark As String
Set rs = Forms!Media.Form.RecordsetClone
With rs
Do Until .EOF
.Delete
.MoveNext
Loop
End With
DoCmd.SetWarnings False
RunCommand acCmdDeleteRecord
Exit_EditDelBox_Click:
DoCmd.SetWarnings True
Exit Sub
Err_EditDelBox_Click:
MsgBox Err.Description
Resume Exit_EditDelBox_Click
End Sub


After click I get error message Cannot update database or object is read-only. And record isn't been removed. Well I founded this script on internet.... I'm really not good in VB.

But problem could be somewhere else. I opened form by macro and I couldn't fill some fields in form. It looks like that form is really locked (but subforms are OK). I just used simple macro "OpenForm" and set only Name of form to be opened.
Could anybody helps?
Thanks
 
Do you have a form open based on that record? i.e. are you trying to delete the record whilst you have it open in some kind of form? Or is somebody else in the db if it hasn't been split?
 
Thanks for response. Yes I'm trying to remove actual opened record. Should be done like this way?
 
Welll the problem was that I had resume on main form of the records. When I removed this subform from main form then I was able to remove record.
Ok I can delete record but I need this summary subform on main form. How can do that? I mean show subform and delete record in other subform?
 

Users who are viewing this thread

Back
Top Bottom