473,397 Members | 1,961 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

lock table

Hi all,
would someone know how to unlock a table in msaccess,vba?

a combobox on update gives me an error table lock

now I tried everything I can think of

'DoCmd.Close acTable, "tmpCatgoryProductTable"

' DoCmd.Close acQuery, "qryDistinctCat"
' DoCmd.DeleteObject acTable, "tmpCatgoryProductTable"

DoCmd.Close acQuery, "qrySelectProductList"

DoCmd.Close acQuery, "qryDistinctCat"
DoCmd.Close acTable, "tmpCatgoryProductTable"
DoCmd.Close acQuery, "qrySelectDivisionProducts"

MsgBox ("afterupdate")
DoCmd.OpenQuery "qrySelectDivisionProducts"

but the qry which reads from the tmpCatgoryProductTable, gives me that the table is lock

Ideas please
Daniel
Feb 12 '08 #1
6 6268
puppydogbuddy
1,923 Expert 1GB
Hi all,
would someone know how to unlock a table in msaccess,vba?

a combobox on update gives me an error table lock

now I tried everything I can think of

'DoCmd.Close acTable, "tmpCatgoryProductTable"

' DoCmd.Close acQuery, "qryDistinctCat"
' DoCmd.DeleteObject acTable, "tmpCatgoryProductTable"

DoCmd.Close acQuery, "qrySelectProductList"

DoCmd.Close acQuery, "qryDistinctCat"
DoCmd.Close acTable, "tmpCatgoryProductTable"
DoCmd.Close acQuery, "qrySelectDivisionProducts"

MsgBox ("afterupdate")
DoCmd.OpenQuery "qrySelectDivisionProducts"

but the qry which reads from the tmpCatgoryProductTable, gives me that the table is lock

Ideas please
Daniel
This sounds like a problem with your Lock DB (ldb) file not closing as it should when you exited your application. Without booting your application, go to the directory where your mdb file is and see if there is file with the same name as your mdb, but with the extension ldb. If there is, you need to delete it. If it won't allow you to delete, you have to reboot windows and then delete the file. After deleting the file, the lock should be cleared. You need to fix the problem query or you will lock up the application again.
Feb 13 '08 #2
a query creates a temptable and locks the table, I need to reuse the query and recreate the table, on a combobox change.

but it will not allow me, since it is locked. how can I clear the lock on the tmptable? I tried closing/opening the query, and closing the table. it is still locked

I tought maybe there would be a way to do this in code.

thanks
Daniel
Feb 13 '08 #3
puppydogbuddy
1,923 Expert 1GB
a query creates a temptable and locks the table, I need to reuse the query and recreate the table, on a combobox change.

but it will not allow me, since it is locked. how can I clear the lock on the tmptable? I tried closing/opening the query, and closing the table. it is still locked

I tought maybe there would be a way to do this in code.

thanks
Daniel
Try a DB compact and repair and see if that unlocks the table for you. Let me know if i works for you..
Feb 13 '08 #4
nope did not change anything,

do not know what to do, or try

Daniel
Feb 14 '08 #5
puppydogbuddy
1,923 Expert 1GB
nope did not change anything,

do not know what to do, or try

Daniel
Try compacting with the Jet Compact utility. It corrects problems that Access Compact does not. Code obtained from tips page of www.aadconsulting.com. If this does not do the trick, let me know. I have at least 2 other things for you to try.

Compact a Database Using Jet

Expand|Select|Wrap|Line Numbers
  1. Function CompactDb(strSourceDB As String, strDestDB As String)
  2.  
  3. Dim jetEngine As JRO.JetEngine
  4. Dim strSourceConnect As String
  5. Dim strDestConnect As String
  6.  
  7.  
  8. ' Build connection strings for SourceConnection
  9. ' and DestConnection arguments
  10. strSourceConnect = "Data Source=" & strSourceDB
  11. strDestConnect = "Data Source=" & strDestDB
  12.  
  13. Set jetEngine = New JRO.JetEngine
  14.  
  15. jetEngine.CompactDatabase strSourceConnect, strDestConnect
  16.  
  17. Set jetEngine = Nothing
  18.  
  19. End Function
Feb 14 '08 #6
puppydogbuddy
1,923 Expert 1GB
Daniel,

If the temporary table is part of the tables collection, the following code should work: See this link
Expand|Select|Wrap|Line Numbers
  1. DoCmd.DeleteObject acTable, "tablename"
  2. On Error Resume Next
where tablename identifies the table you need to delete before creating it with the Execute method. Now, let's suppose the table doesn't exist. In that case, the above statement will create an error, which is handled nicely with an On Error statement in the form
___________________________________________


If the above does not work, you can try this if the temp table is part of the Tables Collection.

Expand|Select|Wrap|Line Numbers
  1. Dim myTable As String
  2. myTable = "NameOfTable"
  3. If CurrentDb.TableDefs(myTable).Name > "" Then
  4. CurrentDb.Execute "DROP TABLE [" & myTable & "]"
  5. Else
  6. Exit Sub
  7. End If
__________________________________________________ _

if none of the above suggestions worked, then I would proceed as if my database were corrupted. The usual procedure followed is to create a new blank database, and then import all of the objects in the problem database, except for the temporary table that you can't delete or unlock.

Hope this helps.
Feb 14 '08 #7

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

Similar topics

2
by: xixi | last post by:
i am using type 4 driver with fp3 on windows 64bit server, auto commit is true, cursor is CS type. i have a sensitive , updatable cursor open and bring back a one row resultset, i get this...
5
by: xixi | last post by:
hi, i am using db2 udb v8.1 on windows, i create a index on a unique value column on a table to try to create row lock, here is what i do , sql = select value from table where id=1 for update,...
9
by: Jane | last post by:
Our db2diag.log is full of messages like this: 2004-05-31-17.15.10.383766 Instance:tminst1 Node:000 PID:394948(db2agent (TMDB1) 0) TID:1 Appid:GA140956.EF26.03A4B1202647 data management ...
0
by: Bruce Pullen | last post by:
DB2 v7.2 (FP7 - DB2 v7.1.0.68) on AIX 5.2.0.0. We're seeing unexpected single row (then commit) insert locking behaviour. We're seeing Applications that already hold row-level W locks in...
2
by: Trent | last post by:
Hello, all. I have the following production DB2 environment. DB2 8.1.4 (fp4) WG edition with 2 production databases on Windows 2003 standard edition. My first question is regard with...
8
by: Roy Padgett | last post by:
I have a combo box where users select the customer name and can either go to the customer's info or open a list of the customer's orders. The RowSource for the combo box was a simple pass-through...
2
by: adri4n | last post by:
as wat ive mentioned in the title.. im would like to know whether the a particular record/table is being locked in my program. some of the methods which i would like to develop are as below: ...
2
by: shenanwei | last post by:
DB2 V8.2 on AIX, type II index is created. I see this from deadlock event monitor. 5) Deadlocked Connection ... Participant no.: 2 Lock wait start time: 09/18/2006 23:04:09.911774 .........
9
by: kavallin | last post by:
I receives the following in the db2diag.log file many times / day : 2007-03-05-14.55.24.836553+060 E12415C457 LEVEL: Warning PID : 2785 TID : 1 PROC :...
6
by: michael.spoden | last post by:
Hi, how can I fix lock-waits during an online backup? Is an online backup in DB2 V8.2 not realy online? I'm using DB2 V8.2 Fixpak 15 on Linux. The command to perform the backup is: db2 backup...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...

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.