In my dataset which lists configurations, some records contain up to 6000 character configuration strings in a Memo field (named 'PermissionString').
The Memo string is hashed and saved to another field for joining to other tables.
The configurations are displayed on a continuous form with all fields locked for editing. Each record on the form has an edit button. The edit button populates the information of the particular record to an unbound form for the user to edit. This edit form also contains validation. Whilst editing, the continuous form is not closed.
ERROR: -2147217887
Could not update; currently locked by another session on this machine.
This code behind the edit form fails when saving to the PermissionString field (memo field).
If I comment the line, then the record saves fine.
Any ideas ?
The Memo string is hashed and saved to another field for joining to other tables.
The configurations are displayed on a continuous form with all fields locked for editing. Each record on the form has an edit button. The edit button populates the information of the particular record to an unbound form for the user to edit. This edit form also contains validation. Whilst editing, the continuous form is not closed.
ERROR: -2147217887
Could not update; currently locked by another session on this machine.
This code behind the edit form fails when saving to the PermissionString field (memo field).
If I comment the line, then the record saves fine.
Any ideas ?
Code:
Private Function mblnSaveRecord()
On Error GoTo PROC_ERR
Dim blnReturn As Boolean
Dim objConn As ADODB.Connection
Dim objRst As New ADODB.Recordset
Dim strSQL As String
Dim strPermissionString As String
Set objConn = CurrentProject.Connection
strSQL = ""
strSQL = strSQL & "SELECT PermissionString, Access, Hash, Dataset, ArchivedDate, IIf(IsNull([Archiveddate]),0,1) AS Archived "
strSQL = strSQL & " FROM ProfileMapping "
strSQL = strSQL & " WHERE ProfileID =" & gudtProfile.ProfileID
objRst.Open strSQL, objConn, adOpenStatic, adLockPessimistic
With objRst
If gudtProfile.ProfileID = 0 Then
' add new record
.AddNew
!Access = txtAccess.value
strPermissionString = Trim(txtPermissionString.value)
!Dataset = cboDataset.value
!PermissionString = strPermissionString
!Hash = MD5_string(strPermissionString)
.Update
Else
If Not .EOF Then
!Access = txtAccess.value
strPermissionString = Trim(txtPermissionString.value)
!Dataset = cboDataset.value
!PermissionString = strPermissionString
!Hash = MD5_string(strPermissionString)
If chkArchive = True And gudtProfile.ArchivedDate = 0 Then
If vbYes = MsgBox("Are you sure you want to archive this record", vbYesNo, "ARCHIVE RECORD ?") Then
!ArchivedDate = Now
End If
ElseIf chkArchive = False And gudtProfile.ArchivedDate <> 0 Then
If vbYes = MsgBox("Are you sure you want to restore this record", vbYesNo, "RESTORE RECORD ?") Then
!ArchivedDate = Null
End If
End If
.Update
End If
End If
End With
Forms!frmProfiles.Requery
blnReturn = True
PROC_EXIT:
On Error Resume Next
objRst.Close
Set objRst = Nothing
objConn.Close
Set objConn = Nothing
mblnSaveRecord = blnReturn
Exit Function
PROC_ERR:
MsgBox Err.Number & vbNewLine & Err.Description
blnReturn = False
Resume PROC_EXIT
End Function
Last edited: