Visual Basic Run-time error '3211'

  • Thread starter Thread starter Tony Girgenti
  • Start date Start date
T

Tony Girgenti

I'm trying to execute the following code and i am getting this error:

"Run-time error '3211'; The database engine could not lock table 'Items'
becuase it is already in use by another person or process".

This code is being executed in AccessXP using an ODBC connection to a server
DB. I'm not sure exactly which statement it is giving the error on.
All other computers were turned off and the one computer was restarted, but
we still get the error. The table is not being used by a form.

Any help would be greatly appreciated.

Tony

============================================================================
=================================
CurrentDb.Execute "DROP TABLE Items"

DoCmd.TransferDatabase acImport, "ODBC Database", _

"ODBC;DSN=DEMO2ENG;ArrayFetchOn=1;ArrayBufferSize=8;DBQ=DEMO2ENG;OpenMode=0;
DecimalSymbol=.;;TABLE=Items", _
acTable, "Items", "Items"
CurrentDb.Execute "CREATE UNIQUE INDEX ItemNumIdx ON Items (ItemNumber)"
 
The error likely is occuring on one of these lines of code:

CurrentDb.Execute "DROP TABLE Items"
or

CurrentDb.Execute "CREATE UNIQUE INDEX ItemNumIdx ON Items (ItemNumber)"

What it means is that the table Items in your current database (not the one
being connected to by the ODBC call) cannot be locked by Jet database engine
because ACCESS believes that someone else is editing a record in that table.

This can result from different things, but without knowing more about your
setup, I'll just list a few:
-- a form or subform bound to the table or to a query based on that
table that is open and being used at the time you try to run the code;
-- another user is using the same front end database file at the time
you're trying to run this code and may be using that table;
-- the table is corrupted;
-- etc.
 
Thanks Ken.
I think what i'll try to do is delete the table manually and recreate it
thru file import.

Thanks for your help.
Tony
 
Back
Top