Error 3188 - Could not update; currently locked by another session on this machine ? (1 Viewer)

liamfitz

Registered User.
Local time
Today, 15:42
Joined
May 17, 2012
Messages
240
The following is the problematic section of code, in a form opened from another. The form which opens it, is a main Client form. On the form which is opened from a click on the Client form, it updates a field ( Disability_Type_IDS ) in the main table used by the first/calling form. How can I avoid this 'conflict' occuring.
Code:
Set db = CurrentDb
        Set rst = db.OpenRecordset("SELECT tblClients.Disability_Type_IDS " & _
                                   "FROM tblClients WHERE " & _
                                   "(((tblClients.Client_ID)=" & Forms!frmClients.cl & "));", dbOpenDynaset)
            If Not (rst.BOF And rst.EOF) Then
                With rst
                    .Edit
                    !Disability_Type_IDS = strDisType
                    .Update
                End With
            End If
Th error message occurs on the line .Edit.:banghead:
 

llkhoutx

Registered User.
Local time
Today, 10:42
Joined
Feb 26, 2001
Messages
4,018
I've encountered this problem before. The form locks the record/table.

Before the edit change the form record source to empty, do the edit, then reset the form record source at the appropriate record.
 

boblarson

Smeghead
Local time
Today, 08:42
Joined
Jan 12, 2001
Messages
32,059
Issue a

If Me.Dirty Then Me.Dirty = False

to the main form before popping up the popup form.
 

liamfitz

Registered User.
Local time
Today, 15:42
Joined
May 17, 2012
Messages
240
thank you again boblarson. It's now working. An alternative, round it, also seems to be, referencing the still open ( and at the required record importantly ) recordset, on the calling form. i.e.

Code:
With Forms!frmClients.Recordset
      .Fields("Diability_Type_IDS") = whatever value here
End With

Your suggestion does work though, and I think it's preferable.
;)
 

KaryJane

New member
Local time
Today, 17:42
Joined
Feb 21, 2018
Messages
6
Hi, I have a similar problem but am not sure how to fix it. I have an access database with the table "CV" plus some related tables (eg: Education, Membership, etc). I have a main form with the CV being the datasource (selected in the Property taskpane, Data tab), plus a number of subforms, with the datasources "Education", etc.
This worked perfectly when I tried it with dummy data but now that I've imported the real data from Excel, the error 3188 appears whenever I edit the Memo field of an existing record. I have googled it and found that it may be related to the size of my memo field (i.e. > 2K).
I have not used the code shown above (i.e. set db=currentdb, etc) - I have simply selected the table in the properties taskpane. Since I have not used this, can I still use the fix viz "If dirty ..." suggested by Bob Larsen above? If so, where would I put it? Could you also advise whether I should be using the "Set db=currentdb", and how i could (easily) change my little program? Also, and more importantly, is it essential to fix this Error 3188?
Many thanks, Kary
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 23:42
Joined
May 7, 2009
Messages
19,169
create a query first and select first the memo field followed by the rest of the field
you want to include in the query.

now, create a form (datasheet) that will host your query.

use the form instead of table. check if the error still persists.
 

KaryJane

New member
Local time
Today, 17:42
Joined
Feb 21, 2018
Messages
6
create a query first and select first the memo field followed by the rest of the field
you want to include in the query.

now, create a form (datasheet) that will host your query.

use the form instead of table. check if the error still persists.
--------------------------------
Sorry to be blonde -
* should the query include only fields in the CV table or include those tables in the subforms?
* I understood that fields cannot be edited when the data source is a query?
* "Use the form instead of table" - do you mean "use the query instead of table"?
* Could you advise how this would eliminate the problem of the memo size.
Many thanks, Kary
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 23:42
Joined
May 7, 2009
Messages
19,169
which subform host your memo? only on that subform.
 

KaryJane

New member
Local time
Today, 17:42
Joined
Feb 21, 2018
Messages
6
which subform host your memo? only on that subform.
The main form hosts the memo. If I open a record and the memo field contains <2000 characters, I can edit it; if >2000 the error message appears.
Thank you for your help :)
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 23:42
Joined
May 7, 2009
Messages
19,169
create the query on the main form.
make the memo field first in your Select statement.
 

KaryJane

New member
Local time
Today, 17:42
Joined
Feb 21, 2018
Messages
6
Thanks Arnelgp, I have done as you suggested but it doesn't solve the problem. I can edit any of the other fields; it's only when I edit a record with a long memo field which is an issue. If I edit a record with a short memo field, it works perfectly. BTW - my memo field contains "Key Qualifications" for the CV info; it will be fairly static but definitely will be over 2K for most staff members.
 

KaryJane

New member
Local time
Today, 17:42
Joined
Feb 21, 2018
Messages
6
Ok, so despite thinking I only had one instance of the memo field open, I finally realized I was displaying it on my main staff form as well as in the registration form, which was loaded from the staff form. I tried creating a query for the Registration Form but the error continued; it was only when I used a query for the Staff Form and changed the name of the memo field that I could save memo's >2K in the Registration Form. Thanks again Arnelgp for your help :)
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 23:42
Joined
May 7, 2009
Messages
19,169
Im out all day, but glad you resolved it.
 

Users who are viewing this thread

Top Bottom