Hello,
I have a form that allows me to add or edit data to a table. In that table I have a Memo field called 'fld_Tech_Intr'.
When I first create the record I'm able to add 2,000 plus characters to that memo field 'fld_Tech_Instr'.
When I try to update that field by using a RecordSet I receive an access error.
"Error Number -2147217887, Could not update; currently locked by another session on this machine."
This only happens when my memo field is 2,000 plus characters. If the memo field is shorter, I don't get the error. There is no one else using the database when I'm making this change so I know it's not another user locking out my record.
I'm searched around the internet and I only found a thread that this was Microsoft bug. Is there a way around this error? I want to continue to use RecordSets to update my data. I don't want to put a character limit of 2,000 on my memo fields.
Here is my RecordSet code that I used to update my table. For sake of keeping it small I only including the one Memo Field I'm having problems with.
Thank You!
I have a form that allows me to add or edit data to a table. In that table I have a Memo field called 'fld_Tech_Intr'.
When I first create the record I'm able to add 2,000 plus characters to that memo field 'fld_Tech_Instr'.
When I try to update that field by using a RecordSet I receive an access error.
"Error Number -2147217887, Could not update; currently locked by another session on this machine."
This only happens when my memo field is 2,000 plus characters. If the memo field is shorter, I don't get the error. There is no one else using the database when I'm making this change so I know it's not another user locking out my record.
I'm searched around the internet and I only found a thread that this was Microsoft bug. Is there a way around this error? I want to continue to use RecordSets to update my data. I don't want to put a character limit of 2,000 on my memo fields.
Here is my RecordSet code that I used to update my table. For sake of keeping it small I only including the one Memo Field I'm having problems with.
Code:
'Declare DIMs
Dim RecordSet As New ADODB.RecordSet
Dim Connection As ADODB.Connection
Dim strSearchFieldName As String
Dim intFindValue As Integer
Dim strRecSetTble As String
Dim intTbleFldCnt As Integer
'Define DIMs
strSearchFieldName = "fld_Work_Order_ID"
intFindValue = Me.txt_fld_Work_Order_ID
strRecSetTble = "tbl_Work_Orders"
intTbleFldCnt = 1
Set Connection = Application.CurrentProject.Connection 'Sets the connection to the current project
RecordSet.Open strRecSetTble, CurrentProject.Connection, adOpenKeyset, adLockOptimistic 'Pulls the info from the table
Connection.BeginTrans 'Begins a new transaction
'Searches on the table for the strSearchFieldName that is equal to intFieldValue
RecordSet.MoveFirst
Do While Not RecordSet.EOF
If (RecordSet(strSearchFieldName).Value = intFindValue) Then
'intTbleFldCnt is going to be equal to the # of fields in the RecordSet table - It steps through each field
For intFieldCount = 1 To intTbleFldCnt Step 1
strFieldName = "fld_Tech_Instr"
varFieldTemp = Me.txt_fld_Tech_Instr
'Test for Null or "" - Table won't accept ""
If varFieldTemp & "" = "" Then
RecordSet([strFieldName]).Value = Null 'No data in field = Null
Else
RecordSet([strFieldName]).Value = varFieldTemp
End If
Next intFieldCount
RecordSet.Update
Exit Do
End If
RecordSet.MoveNext
Loop
Connection.CommitTrans 'Saves any changes and ends the current transaction
'Clean Up
RecordSet.Close
Connection.Close
Set RecordSet = Nothing
Set Connection = Nothing
Thank You!