Solved

Unlocking Tables not used by anyone while other users are using the DB

Posted on 2011-02-16
15
956 Views
Last Modified: 2012-05-11
I have a DB used by 20 users at any given time.  There is an administrative routine that drop and creates tables.  Users have no access to these tables.

When users are in the DB though I get the following message:

"You tried to lock table '900 Available Hours Prep 1a' while opening it, but the table cannot be locked because it is currently in use. Wait a moment, and then try the operation again"


I tried with the following code but I get the same message:

             DoCmd.DeleteObject acTable, "900 Available Hours Prep 1a"
0
Comment
Question by:fitaliano
  • 5
  • 3
  • 2
  • +1
15 Comments
 
LVL 44

Expert Comment

by:GRayL
ID: 34912548
It's time you learned - I don't talk to people who put spaces in names, bye.
0
 
LVL 84
ID: 34912674
Yes, PLEASE adopt proper nameing conventions. This will end up biting you at some point.

Access can lock several tables for a single operation, depending on the relationships between those tables. It's entirely possible that your drop/recreate routines are impacting this, and locking those tables.

Is there a reason you must drop the table? In most cases it's better to delete the information and then just refill the table. This would almost certainly stop your error message as well.

And please - do something about your object names. There's just no reason to name a table like that, and if you EVER have to move up to SQL Server you'll find that those names aren't allowed.
0
 

Author Comment

by:fitaliano
ID: 34912693
I changed the name to 900_Available_Hours_Prep_1a"

Any suggestion to solve my issue now?
0
 
LVL 84
ID: 34938381
I'll restate my question to you:

Is there a reason you must drop the table? In most cases it's better to delete the information and then just refill the table. This would almost certainly stop your error message as well.

0
 
LVL 40

Expert Comment

by:Vadim Rapp
ID: 34940855
You can try to delete .ldb file in the same directory as the mdb.

In case the file is locked on the system level, you can try utilities described at this webpage: http://www.howtohaven.com/system/deleteundeletablefiles.shtml. But it's all quite unstable, and may result in data loss and in damage to the data in the database, so it would be better to come up with less intrusive solution.

By the way, there's absolutely nothing wrong in having spaces in table names, except the little trouble of enclosing these names in quotes whenever they are used. They are also supported in SQL Server (source: http://msdn.microsoft.com/en-us/library/ms175874.aspx )
0
 

Author Comment

by:fitaliano
ID: 34943066
the reason why i drop the table is because I have complex calculations that I'm staging putting data in some tables and doing other queries on these staging tables up to some other tables and so on...

0
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
LVL 44

Expert Comment

by:GRayL
ID: 34943635
vadimrapp1:  Google - Access naming convention - the first three hits say do not use spaces - one even says do not use underscores - I'm a believer.
0
 
LVL 40

Expert Comment

by:Vadim Rapp
ID: 34943781
GrayL, author's thread is not the best place for discussions between experts; if you want, we can open a private thread to discuss your beliefs.
0
 
LVL 84
ID: 34943797
<By the way, there's absolutely nothing wrong in having spaces in table names, except the little trouble of enclosing these names in quotes whenever they are used. They are also supported in SQL Server (source: http://msdn.microsoft.com/en-us/library/ms175874.aspx ) >

The document you cite specifically states this in the "Rules for Regular Identifiers" section:

"4. Embedded spaces or special characters are not allowed."

And further:

"Identifiers that do not comply with all the rules for identifiers must be delimited in a Transact-SQL statement. For example: "

So you CAN use them - they're just not allowed, as I stated in my earlier comment. You must take special care to delimit them correctly in order to use them in your code, just as you do when working with non-standard object names in Access.

0
 
LVL 84

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 500 total points
ID: 34947269
<the reason why i drop the table is because I have complex calculations that I'm staging putting data in some tables and doing other queries on these staging tables up to some other tables and so on...>

Understood, however if you're simply using SELECT INTO for your make table stuff, you can easily convert that to INSERT INTO and avoid the possibility of locking tables while dropping them. Granted you could still have lock issues when doing the INSERTS, but those would be more rare with a single user (i.e. you) doing the INSERTS.

If you could explain a bit more about your process perhaps we could assist further.
0
 
LVL 40

Expert Comment

by:Vadim Rapp
ID: 34951427
Now that the main question is resolved - regarding the spaces in table names: what the document says is the identifiers can be regular and delimited. There's nothing that says that delimited are somehow inferior to the regular, or that either of them are recommended over another, not to mention "aren't allowed".

Also, if I may, I think it's more productive and courteous to the question author to first resolve the problem he posted, and only by that to earn in his eyes the authority to give general advise criticizing his coding style - even when that advise is 100% right on target.
0
 
LVL 84
ID: 34951625
"4. Embedded spaces or special characters are not allowed."

I don't see how that is ambiguous or vague in any way. I realize that the article does go further to say  that if you decide to use characters or conventions which are disallowed, then you must take special steps to insure they can be parsed correctly.

Also, I'd be willing to bet that if you asked this question to the experienced developer community at large, you'd find a very solid (if not overwhelming) majority of those developers would come down on the side of "no spaces in object names", regardless of what environment we're talking about (i.e. db development, app developement, etc). This may change at some point, of course, but I don't see it changing in the near future.

And, as _alias99 said in your Community Support request, this might be more appropriate to continue in the Experts Lounge or the Access Discussion thread.

0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now