473,796 Members | 2,625 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Cannot update: record locked by another session

4 New Member
I have the following code in an Access 2003 database:

Expand|Select|Wrap|Line Numbers
  1. Dim myConnecion As ADODB.Connection
  2. Set myConnection = CurrentProject.Connection
  3.  
  4. Dim myTable As ADODB.Recordset
  5. With myTable
  6.     .ActiveConnection = myConnection
  7.     .Open "someTableInMyDB", , ad???Dynamic,adLockOptimistic
  8.     End With
  9.  
  10. If Not myTable.EOF Then myTable.MoveFirst
  11.  
  12. Do Until myTable.EOF
  13.     If myTable.Fields("WorkOrderNumber") = woNum Then
  14.         Exit Do
  15.         End If
  16.     myTable.MoveNext
  17.     Loop
  18.  
  19. myTable.Delete
  20. myTable.Close
For one particular table, in one module this code locks up at the .Delete line. Access throws an error that says the record is locked by another session on my machine. When I look at the call stack there are two modules open. The one that is running and fails, and the one that called it. The module that calls this one doesn't access this particular table.

Is there a way to get VBA to show all running sessions? What other method could I use to track down where this record is being locked so I can fix this error? Ideas???
Sep 25 '07 #1
2 2865
gbergeson
4 New Member
Okay, I solved this for now. The code above is in a "Utility" module. It was being called from a form that locked the record being edited. Thus, the form had the record locked and then called the module to edit the locked record. Oops!
Sep 26 '07 #2
Scott Price
1,384 Recognized Expert Top Contributor
You could try the adLockBatchOpti mistic instead of the adLockOptimisti c, although I don't have much confidence that it will solve your problem. The adLockOptimisti c is supposed to only lock the record upon calling the .Update command. The batch optimistic is required for batch updating..

Regards,
Scott
Sep 26 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

29
3196
by: Mainlander | last post by:
An ISP I belong to uses Majordomo for their mailing list system. I'd like to encourage them to move to a system that uses a database, preferably psql which they already run on their server. Anything out there in Php?
3
3692
by: David W. Fenton | last post by:
A very old app of mine that's been in production use, and largely unchanged since about 1998 has started recently throwing error 3188 (can't update, locked by another session on this machine) when saving edits to some memo fields. I have found a number of things: 1. it happens only with long memo fields, starting somewhere above 255 characters (though I don't know exactly where.
4
1918
by: Lada 'Ray' Lostak | last post by:
Hello there, I am thinking how to solve another typical problem of online systems with combination of thin client... Imagine simple case, 2 users are going to edit 'same' datas. Both see on the 'screen' the same, after they started edit them. First one changes datas and submit changes (sucessfully). Database (set tables - inserts/updates/deleting) was changed. At this point, datas which second user is watching are not valid anymore. They...
1
8504
by: Mark Reed | last post by:
Hi All, I'm having a problem with the following code. I've read quite a lot of old posts regarding the issue but none seem to affer a solution. The scenario is. I have a bound form which contains a couple of memo fields. I need to keep some sort of log as to when each update of the memo field occurs so I have locked bot the memo fields on the main form. To edit them, the user double clicks the ememo field which then opens an unbound...
7
12186
by: Mathew Butler | last post by:
I'm investigating an issue I have when pulling data back from MS access I'm retrieving all rows from a column in a table of 5000 rows - accessing a column of type "memo" ( can be 65353 character long) . I'm pulling the data back using ODBC. Details are: Microsoft Access Driver 4.00.6306.00 Jet 4.0 release level that is currently installed (Msjet40.dll ) "Microsoft Jet Engine Library" 4.0.9025.0 After 291 rows are retreived I am...
3
3956
by: epearce301 | last post by:
Hi, I have table1 and table2, both are linked, and a query has been run. I created forms that use both just the tables, and then another one using just the query. All of the information is there, but I cannot edit any records nor can I move to a new record on the forms. I checked to see if they were locked, and they are not. Please help!
0
3239
by: Access Programming only with macros, no code | last post by:
ERROR MESSAGE: Could not update; currently locked by another session on this machine. BACKGROUND I have the following objects: Table1 - HO (which has about 51,000+ records) Table2 - Contact (which has 68,000+ records)
6
11337
by: stuart | last post by:
I have 2 users who ran into a problem with a data entry program (written in Access 2003). One user was keying into one of the forms when she got the message "ACCESS Error Number: 3218 Could not update; currently locked'. About the same time, another user was keying records into a 2nd form. Even though they were on different forms, they would have added records to the same table. The 2nd user had tried to add about 28 records, the...
11
3490
ollyb303
by: ollyb303 | last post by:
Hi, I have a problem with a multi-user db in Access 2000. The db is for logging calls to my company and will be used by up to 30 people, though currently around 10 are using it. I have split the db into front/back end and each user is using a local copy of the front end, connected to the back end via our network. It was all working fine when we tested it (across 2 different sites) and had no problems, but now, some new users are...
0
9685
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10459
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10237
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10187
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7553
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5446
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5578
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4120
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3735
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.