473,699 Members | 2,485 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Table lock problem while trying to delete

1 New Member
Hey guys, I am getting a "database cant lock table "blah" because it is already in use by another person or process" while trying to delete, then re-populate it. This table is viewed in a subform (CSD appender embedded) in datasheet view, and I have been changing the recordsource of the form to another table, making any changes that are required, then setting it back. This is a technique which I have been using successfully throughout the code within this form but has started causing a problem as I have added a new peice of code.

I have checked the recordset properties in both the parent and child form objects, and both of them are set to different tables. I have also checked the recordsets.coun t property is 0 to ensure that I have closed any recordsets that I may have open on the table.

It seems like a system setting which I cannot access is still set somewhere and I am unsure how to change this.

Code:
Private Sub pull_matches()
Dim display As String
DoCmd.SetWarnin gs False
frm_view = "matches"

For Each varItm In Show.ItemsSelec ted
display = display & "[zzappend].[" & Show.ItemData(v arItm) & "], "
Next varItm
display = left(display, Len(display) - 2)
Forms![csd appender].Form![csd appender embedded].Form.RecordSou rce = "zzappend"

If Table_exists("z zappend_temp") Then
DoCmd.DeleteObj ect acTable, "zzappend_t emp" 'This is where the error occurs
End If

sql = "SELECT " & display & ", [zzappend].ID, zzappend.[change to] INTO zzappend_temp FROM zzappend WHERE (((zzappend.shv 1) IN (SELECT [shv1] FROM [zzappend] as tmp GROUP BY [shv1], [" & Cmbpostcode.Val ue & "] HAVING count(*)>1 AND " & Cmbpostcode.Val ue & " = [zzappend]." & Cmbpostcode.Val ue & "))) ORDER BY zzappend.shv1, zzappend.[" & Cmbpostcode.Val ue & "];"
DoCmd.RunSQL (sql)

sql = "ALTER TABLE zzappend_temp ADD changed bit"
DoCmd.RunSQL (sql)

Forms![csd appender].Form![csd appender embedded].Form.RecordSou rce = "zzappend_t emp"
DoCmd.SetWarnin gs True

End Sub
Jan 17 '08 #1
1 3559
PianoMan64
374 Recognized Expert Contributor
The reason that you're getting that error, is because the table is never closed, especially if it is in the same current Database. That's the reason that you're getting that error.

If it was something that when you openned another instance of that up, and made sure that the table is not currently being view by anyone including yourself, then you would be able to delete the record, but since you have it open in the current instance of the database, you can't do that, you simply can change the data within it, and even the structure, but not delete the table all together.

Hope that helps,

Joe P.
Jan 20 '08 #2

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

Similar topics

6
3978
by: gdekhayser | last post by:
To any and all; I have a very large table (16Mil+ records), for which I want to delete about 8 Million records. There are a few indexes on this table. Is there a way that I can run either a query or a series of queries that will run against each record and delete based on criteria (date)? If I do a single DELETE query, it will take forever, lock the table, and my app that runs against it will stop INSERTING, which is bad.
2
11355
by: G.W. Lucas | last post by:
I apologize if this is a RTFM question, but I have not been able to find a definitive answer elsewhere. Does a "REINDEX TABLE" lock the table while it is working? Can applications write data to the table during the REINDEX? I am working on a real-time application that handles over 2 million "events" per day and runs 7-by-24. Most of these events involve an UPDATE to one or two tables, though a small subset involve a bit more work. ...
3
6904
by: Joachim Klassen | last post by:
Hi all, first apologies if this question looks the same as another one I recently posted - its a different thing but for the same szenario:-). We are having performance problems when inserting/deleting rows from a large table. My scenario: Table (lets call it FACT1) with 1000 million rows distributed on 12
4
10674
by: deko | last post by:
I'm trying to delete a table with db.execute DROP TABLE tempTable I've tried first clearing the RecordSource of the forms that use tempTable like this: Me!RecordSource = "" But it does not seem to help. I still get this error:
8
6808
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 query: SELECT DISTINCT , , ,City, Region FROM Customers ORDER BY Customers.; This was working fine until a couple of weeks ago. Now whenever someone has the form open, this statement locks the entire Customers table.
4
41013
by: deko | last post by:
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...
9
2289
by: BillCo | last post by:
I have a function which clears out a temporary table and then fills it with values from a recordset. One of the table fields is indexed with no duplicates. Very rarely - almost enough to ignore it - two users will call the function at once causing one of the functions to attempt to update the table with duplicate values. Is there a way to lock the table to prevent this happening? Function() 'wait until tmpTable is free
2
4409
by: John Bokma | last post by:
I am quite new to MS SQL, and I want to read rows from a todo table, and when a row has been processed, I want to delete that row. Ages ago in MySQL I would probably have locked the table, select, process a row, delete a row, unlock the table. I have been reading through the documentation from MS SQL, but it's not clear what exactly I should do. Since I want to lock only one table in the select (the others just provide
5
9436
by: Roger | last post by:
I am doing some mass update on DB2 8.2 FP10 (say 400 to 500 rows on a 5000 row table) with just one commit. So this is taking lot of exclusive row locks as expected. When I run a select on the same table with a where clause its taking a IS table lock. This is causing the select to go on lock waiting. The application cannot do UR isolation level. Why is it taking IS table lock ? There is an index on the where clause. How can i...
0
8618
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9178
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
9035
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...
0
8885
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5875
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4631
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3058
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
2348
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2010
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.