By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,476 Members | 1,376 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,476 IT Pros & Developers. It's quick & easy.

Could not Update currently lock by other session on this computer

100+
P: 134
Hi, every time I run the below statement, it display error message "Could not Update , currently lock by other session in this computer.

I am running on a stand-alone PC.
Expand|Select|Wrap|Line Numbers
  1. Dim rst As New ADODB.Recordset, sqlstmt As String
  2.  
  3. sqlstmt = "SELECT * from tblvndprod where productID=" & Me.ProductID
  4.  
  5. rst.Open sqlstmt, CurrentProject.Connection, adOpenDynamic, adLockOptimistic
  6.  
  7.  With rst
  8.     If Not .EOF Then
  9.     ![Unit] = Me.UnitMeasurement
  10.     .Update
  11.     End If
  12.  End With
  13.  
  14.    rst.Close
  15.    Set rst = Nothing
Dec 18 '07 #1
Share this Question
Share on Google+
3 Replies


100+
P: 134
Hi, every time I run the below statement, it display error message "Could not Update , currently lock by other session in this computer.

I am running on a stand-alone PC.

Dim rst As New ADODB.Recordset, sqlstmt As String

sqlstmt = "SELECT * from tblvndprod where productID=" & Me.ProductID

rst.Open sqlstmt, CurrentProject.Connection, adOpenDynamic, adLockOptimistic

With rst
If Not .EOF Then
![Unit] = Me.UnitMeasurement
.Update
End If
End With

rst.Close
Set rst = Nothing

I realize I have a tab control form which consist of Page 1 and Page 2.
If I do an update on Page 1, while Page 2 is open, error message occur.

Bit, If I remove Page 2, everything work well. Is there anyway I could temporary
disable or close the table on Page 2 without removing page 2 ?
Dec 19 '07 #2

NeoPa
Expert Mod 15k+
P: 31,186
As a full member now, you should know that we expect your code to be posted in [code] tags (See How to Ask a Question).
This makes it easier for our Experts to read and understand it. Failing to do so creates extra work for the moderators, thus wasting resources, otherwise available to answer the members' questions.
Please use the tags in future.

ADMIN.
Dec 19 '07 #3

NeoPa
Expert Mod 15k+
P: 31,186
Hi, every time I run the below statement, it display error message "Could not Update , currently lock by other session in this computer.

I am running on a stand-alone PC.
Expand|Select|Wrap|Line Numbers
  1. Dim rst As New ADODB.Recordset, sqlstmt As String
  2.  
  3. sqlstmt = "SELECT * from tblvndprod where productID=" & Me.ProductID
  4.  
  5. rst.Open sqlstmt, CurrentProject.Connection, adOpenDynamic, adLockOptimistic
  6.  
  7.  With rst
  8.     If Not .EOF Then
  9.     ![Unit] = Me.UnitMeasurement
  10.     .Update
  11.     End If
  12.  End With
  13.  
  14.    rst.Close
  15.    Set rst = Nothing
The first thing that jumps out is that .Update is a DAO (not ADODB) function. Your Dim line declares the recordset as ADODB.
Also, a .Update must follow a .Edit. Your code has no visible .Edit.
The multi-page issue may well be a part of this also (seems likely) but clear away the obvious before trying to sort out the less so.
Dec 19 '07 #4

Post your reply

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