Results 1 to 6 of 6
  1. #1
    clancy76 is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Oct 2014
    Posts
    25

    Can't update record, currently locked

    Hi there - I'm working with a legacy mdb that has a tab on the form. On one of of the tabs, I'm using a SQL statement that will update a field on another one of the tabs (If this particular record is updated, the field on the other tab will also get updated). When I execute the statement, I get a message stating "Could not update, currently locked". Now obviously since I'm the only user, I'm assuming the reason I'm getting this message is because the field I'm trying to update is currently open in another tab(If I close the form and run the query it updates fine). Is there a property I can set to prevent this? I've tried setting the forms Record Locks property to "No Locks", had no effect. Any help would be appreciated, thanks.

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    As long as they are within the same form, it should not matter how many controls are bound to a single field, at least not on an old MDB and we are talking about basic style controls.

    Perhaps it is how you are executing your SQL. Can you post the code that executes the SQL?
    Last edited by ItsMe; 04-16-2015 at 09:51 AM. Reason: for clarity removed "not"

  3. #3
    clancy76 is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Oct 2014
    Posts
    25
    This is in the text box's AfterUpdate event (query works fine when the form is closed)

    Dim strSQL as string

    strSQL = "UPDATE tblSite_Update INNER JOIN (tblSite_COS INNER JOIN tblSite_CE ON tblSite_COS.COS_ID = " _
    & "tblSite_CE.COS_ID) ON tblSite_Update.Site_ID = tblSite_COS.Site_ID SET tblSite_Update.Max_Payments = " _
    & "[tblSite_CE].[Unit_Cost] WHERE tblSite_COS.Site_ID =" & Form_sfrmCOS.Site_ID

    db.execute strSQL

  4. #4
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Hmmm, OK. At first blush, it seems like possible duplication of data. That aside, try saving and committing your form before executing your SQL.

  5. #5
    clancy76 is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Oct 2014
    Posts
    25
    ItsMe - I threw in the line "DoCmd.RunCommand acCmdSaveRecord" in the AfterUpdate event before the SQL is executed, is this what you meant? If so, you are a genius, it works now.

    Edit: Also, Thank you!!

  6. #6
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Cool.......

Please reply to this thread with any new information or opinions.

Similar Threads

  1. BeforeUpdate: Could not update; currently locked.
    By v7davisa in forum Programming
    Replies: 3
    Last Post: 09-26-2014, 04:18 PM
  2. Could Not Update, Currently Locked
    By jlclark4 in forum Forms
    Replies: 5
    Last Post: 11-17-2011, 01:21 PM
  3. Err# 3218: Could not update; currently locked.
    By reachvali in forum Access
    Replies: 3
    Last Post: 06-30-2011, 05:13 PM
  4. Error: Can not update record; currently locked
    By waldzinator in forum Programming
    Replies: 4
    Last Post: 03-29-2011, 08:40 AM
  5. Replies: 0
    Last Post: 11-10-2008, 12:35 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums