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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run-time error ‘3218’: Could not update; currently locked

Status
Not open for further replies.

Bresart

Programmer
Feb 14, 2007
314
ES
Hi, i have a Db with DBPix for inserting and viewing images. The code for inserting an image is:

strInputFileName = ahtCommonFileOpenSave(ahtOFN_FILEMUSTEXIST, _
"", strFilter, , ".jpg", "", "Imagen para '" & Me.link & "':", hwnd, True)

[...]
Me.Parent!Secundario68.Form!CtrlActiveX0.ImageLoadFile (strInputFileName)






The main form (vegetable species) has, in order to identify the specie with several images, two subforms: one is a continuous form (Secundario70) with the image name, and by selecting a row in this subform the matching image is displayed in a simple subform (Secundario68).

If after adding the image, i try to delete it (implemented in a command button) the code gives the error:

Run-time error ‘3218’: Could not update; currently locked.

It doesn't occur when there's left another image in the main record, or when i delete the last image but before there was another one (or more than one) deleted first.

Can anybody say how to go around this error?

I would be gratefull for any help given.
 
The error line in the code is the second of these two lines:

DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
 
The DoMenuItem method is deprecated since a long time.
Try to use the equivalent DoCmd.RunCommand method.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thanks PHV.

The code

DoCmd.RunCommand acCmdDeleteRecord

gives the same error.
 
In which form is the command button located ?
Which record you expect to delete ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Sorry, it's not a command button, it's an image in the main form that tries to delete a record in one of the subforms.
 
delete a record in one of the subforms[/i)
Which suborm ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
It deletes a record in the continuous subform (Secundario70 control), based on a table with cascade updating relationship with other table which the other subform is based on (the other subform: a simple one in which the image is displayed).

Thanks.
 
What about this ?
Code:
Me!Secundario70.SetFocus
DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdDeleteRecord

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
It gives the same error in the line


DoCmd.RunCommand acCmdDeleteRecord


Thanks.
 
I have solved it by making an SQL deletion instead of record deletion.

Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top