473,378 Members | 1,500 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,378 software developers and data experts.

How to clear lock on table if error 3211?

I'm trying to import an Excel Spreadsheet into an Access Table but sometimes
things get buttered up if the spreadsheet does not have the right columns.
So I want to drop the Access table and recreate it with a DDL query when
that happens. The problem is I get an error when trying to drop the table -
Error 3211: The database engine could not lock table 'tblExcelTx' because it
is already in use by another person or process.

Is there any way to clear the lock? All I want to do is blow away the
table...
Thanks in advance.
Nov 13 '05 #1
4 40937
deko wrote:
I'm trying to import an Excel Spreadsheet into an Access Table but sometimes
things get buttered up if the spreadsheet does not have the right columns.
So I want to drop the Access table and recreate it with a DDL query when
that happens. The problem is I get an error when trying to drop the table -
Error 3211: The database engine could not lock table 'tblExcelTx' because it
is already in use by another person or process.

Is there any way to clear the lock? All I want to do is blow away the
table...
Thanks in advance.


CurrentDb.TableDefs.Delete "tablename"

But that still doesn't handle the problem since if the table is in use
somewhere it can't be deleted. Have you opened a recordset on the table
somewhere? If so, close the recordset first.

Nov 13 '05 #2
> CurrentDb.TableDefs.Delete "tablename"

But that still doesn't handle the problem since if the table is in use
somewhere it can't be deleted. Have you opened a recordset on the table
somewhere? If so, close the recordset first.


Thanks - I'll give it a shot. The reason the table is locked is because it
gets assigned as the recordsource for a subform. I try resetting with
recordsource = "" before dropping the table but no luck...
Nov 13 '05 #3
deko wrote:
CurrentDb.TableDefs.Delete "tablename"

But that still doesn't handle the problem since if the table is in use
somewhere it can't be deleted. Have you opened a recordset on the table
somewhere? If so, close the recordset first.

Thanks - I'll give it a shot. The reason the table is locked is because it
gets assigned as the recordsource for a subform. I try resetting with
recordsource = "" before dropping the table but no luck...


I'm not sure you can change the record source of a subform when it's
open. Good luck in your quest.
Nov 13 '05 #4
> I'm not sure you can change the record source of a subform when it's
open. Good luck in your quest.


I ended up closing and reopening the form in error handling code:

Exit_Here:
Exit Function
HandleErr:
Select Case Err.Number
Case 3211
DoCmd.Close acForm, "frmTools"
DoCmd.OpenForm "frmTools"
End Select
Resume Exit_Here
End Function

kind of a hack but it works
Nov 13 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: leecho | last post by:
Hi, recently, i was assigned as a new dba for our system. I found that my statistic keep change from time to table. To look for the cause, i wanna to lock a table, means only allow user to...
0
by: Colleyville Alan | last post by:
My app is giving me this error. Run-time error 3211: The database engine could not lock table 'Sorted_Template' because it is already in use by another person or process. When I run the app...
1
by: Sandy | last post by:
Hi I want to lock a table using JDBC as I want to perform some query's (read and write) in exclusive mode. Different threads will be executing the same code simultaneously. I am using the...
0
by: sang | last post by:
Hi I want to lock the table with both read and write there is no action held after lock the table. I know how to lock the table with read and write, lock table mytable read; lock table...
3
by: Himmel | last post by:
I have added a section of code to a function that is designed to copy data from several tables and place them into a single table. The new table already contains a unique ID and name, and I am...
12
by: ewarts | last post by:
Hey Guys, I have an access database with a few tables and forms. I was trying to add a new combo box to one of my forms and to do so i needed to add the referenced data to my reference data table....
1
by: tembil | last post by:
Hi, can anyone plz help me, I'm trying to insert data into a table from another table and I'm getting this error: The total number of locks exceeds the lock table size, how can I fix this. thanx
3
by: Kan09 | last post by:
i have (another) problem. The database i've been trying to design has been going trough a bit of testing. During those tests we've noticed that when trying to access a form from the swich board the...
3
by: Frederick Tant | last post by:
DB2 V9.7 The DB is used by 1 application with no concurrent applications. I got the problem that large update/insert cause lock escalation, to solve the issue I set a lock on the table so...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.