You said you're getting the error on the WTrst.Edit line so you didn't get to the pass-through, I thing setting the ReturnRecords=False might have something to do with it. Can you try this updated code:
Code:
Public Function WorkticketUpdate() \
On Error GoTo Error_Connection
Call SetVars
Dim WTqdf As DAO.QueryDef, WTrst As DAO.Recordset, WTdb As DAO.Database, UpdateSQL As String, Number
'Checks to see if the record is locked
Set WTdb = CurrentDb
Set WTrst = WTdb.OpenRecordset("SELECT * FROM " & Replace(TableFound, "_", ".", , 1) & " WHERE " & StatusCriteria & ";",dbOpenDynaset,dbSeeChanges) 'Replace is needed because when access saves linked tables it replaces "." with "_"
WTrst.Edit 'if locked should go to error handler
Set WTqdf= WTdb.CreateQueryDef("")
WTqdf.Connect = "ODBC;Driver={SQL Server Native Client 11.0};Server=server;Database=database;Network=DBNMPNTW;UID=UID;PWD=PWD;"
WTqdf.ReturnsRecords = False
'Shortens the SQL statement
UpdateSQL = "UPDATE " & Replace(TableFound, "_", ".", , 1) & " SET StatusCode = 'COM', " & _
"StatusTime = '" & Format(Time, "hhmm") & "', " & _
"CurrentStatusComment = 'T/T COMPLETED', " & _
"TimeUpdated = '" & CurrentTime() & "', " & _
"DateUpdated = '" & Date & "', " & _
"UserUpdatedKey = '" & sUserKey & "', " & _
"StatusDate = '" & Format(Date, "yyyy-mm-dd") & "' " & _
"WHERE " & StatusCriteria
'Sets the sql string for the actual update and executes it
WTqdf.SQL = UpdateSQL
WTqdf.Execute
Exit Function
Error_Connection:
Dim dbeError As Error
For Each dbeError In DBEngine.Errors
Debug.Print "(" & dbeError.Number & "): " & dbeError.Description
Next
Call Msgbox("Cannot mark step complete. Someone may be editing the DHR" & vbCrLf & "Error: " & Error & " " & Err.Number)
End Function
Cheers,