database engine couldn't lock a table

A

AlexD

When I'm trying to rename a table by using:

DoCmd.Rename "tblTable", acTable, "tblTable1"

I'm getting a message:

"The database engine could not lock table "tblTable"
because it is in use by another person or process."

Before I did a query, which use this table, such as

Me.cboComboBox.RowSource = "SELECT ... "

How could I free this table to be renamed.

Thanks
 
T

Tim Ferguson

Before I did a query, which use this table, such as

Me.cboComboBox.RowSource = "SELECT ... "

How could I free this table to be renamed.

Close the form containing the cboComboBox...


Tim F
 
A

AlexD

But, I'm doing it by using this form (command button is on
this form).
May be I could somehow free it without closing.
Another cause can be I'm using Me.cboComboBox.Requery?
Thanks
 
T

Tim Ferguson

But, I'm doing it by using this form (command button is on
this form).
May be I could somehow free it without closing.
Another cause can be I'm using Me.cboComboBox.Requery?

Well, I knew that because of the Me! reference, but in the circumstances it
was the kindest answer I could think of.

The real answer is this: what on earth are you doing renaming tables in the
middle of a running database? The table structure is so fundamental, that
any changes really need to be made at about midnight, in the middle of a
long holiday weekend, during a financial recession; so that you have enough
time to get the thing up and running again and tested before anybody wants
to use it. Oh: never mind rewriting all the front end applications, linked
spreadsheets, VB programs, SQL queries, ODBC DSNs and so on and testing
them too. That is for changing a field type. Renaming a whole table counts
as a system re-write, and gets a whole new version number. Think of
changing the engine in a car -- you do it in a garage, not on the highway.

Whatever you hope to achieve by renaming a table, you can do it a better
way without pulling up your own foundations in situ.

Hope that helps but...


Tim F
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top