Record Lock Error

I had a user get an error

"Error 3218 (could not update; currently locked.) in Procedure writePropertyComment of Module modEven_Import_Export_Comments

This message is generated by the application custom error handler (code below).  In the case of a locked record I thought there was a time period the record being inserted waits for the lock to free before generating an error.  Is that correct?

The message was generated out of the following routine, on the Insert command

Public Sub writePropertyComment(passedPropertyID As Long, _
                                passedComment As String, _
                                Optional passedUserName As String = "", _
                                Optional passedCommentTypeID As Long = 1, _
                                Optional passedBRT As Long = 0)
'

'- - - - - - - - - - - - - - - - - - - - - - - - - - G E N E R A T E D  E R R O R  C O D E ----------------
'                          
                               If IsDeveloper Then
                               Else
                                 On Error GoTo writePropertyComment_Error
                               End If
'- - - - - - - - - - - - - - - - - - - - - - - - - - G E N E R A T E D  E R R O R  C O D E ----------------
'
Dim wkUserName As String
Dim wkDateTimeAdded As Date
wkDateTimeAdded = Now

'
If Len(Trim(passedUserName)) > 0 Then
    wkUserName = passedUserName
Else
    wkUserName = GimmeUserName
End If

' add the comment
'
DoCmd.SetWarnings False
'
CurrentDb.Execute " insert into tblProperty_Comments " & _
              "( [BRT], [PropertyID], [CommentTypeID], [Comment], [DateAdded], [UserAdded]   )  " & _
  "   values(" & passedBRT & _
          ", " & passedPropertyID & _
          ", " & passedCommentTypeID & _
          ", " & Chr(34) & Replace(passedComment, Chr(34), Chr(34) & Chr(34)) & Chr(34) & _
          ", " & Chr(35) & wkDateTimeAdded & Chr(35) & _
          ", " & Chr(34) & wkUserName & Chr(34) & _
          ")", dbFailOnError

'- - - - - - - - - - - - - - - - - - - - - - - - - - G E N E R A T E D  E R R O R  C O D E ----------------
                               On Error GoTo 0
                               Exit Sub
writePropertyComment_Error:
                               sysErrorHandler Err.Number, Err.Description, "writePropertyComment", "modEvent_Import_Export_Comments", "Module"
'- - - - - - - - - - - - - - - - - - - - - - - - - - G E N E R A T E D  E R R O R  C O D E ----------------

End Sub


Here is the Error Handler

Public Sub sysErrorHandler(passedErrNum As Long, _
                            passedErrDesc As String, _
                            passedRoutine As String, _
                            passedModuleName As String, _
                            passedModuleType As String)
'
 
'
Dim wkErrUser As String
Dim wkErrDateTime As Date
Dim wkFullErrDesc As String
'
wkErrUser = GimmeUserName
wkErrDateTime = Now
'
wkFullErrDesc = "Err Desc: " & passedErrDesc & ", Routine: " & passedRoutine & ", Module: " & passedModuleName
'
DoCmd.SetWarnings False
'
CurrentDb.Execute " insert into tblErrorLog " & _
              "( [ErrNum], [ErrText], [ErrUser], [ErrDateTime]  )  " & _
  "   values(" & passedErrNum & _
          ", " & Chr(34) & wkFullErrDesc & Chr(34) & _
          ", " & Chr(34) & wkErrUser & Chr(34) & _
          ", " & Chr(35) & wkErrDateTime & Chr(35) & _
          ")", dbFailOnError


gResponse = MsgBox("An error has occurred in your application.  The specific error is:  " & vbCrLf & vbCrLf & _
   "Error " & passedErrNum & " (" & passedErrDesc & ") in Procedure " & passedRoutine & " of " & passedModuleType & Space(1) & passedModuleName & vbCrLf & vbCrLf & _
   "Please copy down the error information on the above lines or take a screen snapshot so you can supply this information when you contact tech support." & vbCrLf & vbCrLf & _
   "Tech support" & vbCrLf & _
   "When you press the ""OK"" button you will exit the system.", vbCritical + vbOKOnly, "Unrecoverable System Condition")
   '      
      Application.Quit acQuitSaveNone


 
End Sub
LVL 1
mlcktmguyAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jeffrey CoachmanMIS LiasonCommented:
custom error handler
Try commenting out the custom error handler, and see what you get, ...then go from there...
0
Gustav BrockCIOCommented:
> I thought there was a time period the record being inserted waits for the lock to free
> before generating an error.  Is that correct?

No. You will handle that yourself. One simple method is reread the data to be updated (this may happen automatically in case of a simple write conflict) and try again once or more.
If the lock persists for an extended time, you may have to skip your update for this time.

Most likely, your error handler can't handle this - if for no other reason that there is no right or wrong method to handle this - it depends on your application.

/gustav
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mlcktmguyAuthor Commented:
Thanks
0
Gustav BrockCIOCommented:
You are welcome!

/gustav
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.