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

Could not update; currently locked

Status
Not open for further replies.

HomeGrowth

Technical User
Aug 19, 2004
76
US
I have a update button to update a record in the subform. the codes are as follow:

Dim cnn As ADODB.Connection
Dim sSQL As String
Set cnn = CurrentProject.Connection
Dim strDocNumber As String

strDocNumber = [Forms]![frm(6-1)SOPEntryForm]![txtDocNumber]

sSQL = "UPDATE [tbl(6)AllDocuments] SET [tbl(6)AllDocuments].Status = ""S"" " & _
"WHERE [tbl(6)AllDocuments].Status Like ""C"" AND " & _
"[tbl(6)AllDocuments].[Doc Number] " & _
"Like """ & strDocNumber & """;"

cnn.Execute sSQL 'Update the record

I got error message: 'Could not update; currently update'

Can't figure out why, any body can shed some lights!!
 
Is by chance [tbl(6)AllDocuments] the underlaying table of the form ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Yes, both the main form and the subform are from [tbl(6)AllDocuments]. I used Access 2000, record should only be locked on the one currently deing on edited, as I set the the lock as 'edited record' only on both forms. Even I tried 'no lock' still give me the same error.
 
You may consider playing with a clone of the form's recordset.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Is a clone recordset updatable to reflect the change in the main table? I used to use it for lookup record only. Just a question to make sure, but I'll try. Thanks!
 
Just for the record, I got my hint from microsoft's website


Basically, I can't not update another record in the subform while updating the record on the main form from the same recordset. My solution was to move this update SQL statement to the AfterUpdate event.

Thank you, All!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top