DDL Query And Error 3211

D

Doctor

When the queries below run they fail with error 3211: table is locked. I've
double checked recordsets again and again to make sure they are closed and
set to nothing. This is the part that doesn't make sense. When I step
through these queries in debugger mode, they work great. Even if I place my
cursor at Exit Sub and run the code to the cursor from the beginning, they
run fine. But if not in debugger mode, they fail.

Thanks in advance for the help.


strSQL = "ALTER TABLE ztblImportChurches ALTER COLUMN State LONG;"
DBEngine(0)(0).Execute strSQL, dbFailOnError
strSQL = "ALTER TABLE ztblImportChurches ALTER COLUMN BillState LONG;"
DBEngine(0)(0).Execute strSQL, dbFailOnError
strSQL = "ALTER TABLE ztblImportChurches ALTER COLUMN ShipState LONG;"
DBEngine(0)(0).Execute strSQL, dbFailOnError
strSQL = "ALTER TABLE ztblImportChurches ALTER COLUMN Country LONG;"
DBEngine(0)(0).Execute strSQL, dbFailOnError
strSQL = "ALTER TABLE ztblImportChurches ALTER COLUMN BillCountry LONG;"
DBEngine(0)(0).Execute strSQL, dbFailOnError
strSQL = "ALTER TABLE ztblImportChurches ALTER COLUMN ShipCountry LONG;"
DBEngine(0)(0).Execute strSQL, dbFailOnError
 
J

John W. Vinson

When the queries below run they fail with error 3211: table is locked. I've
double checked recordsets again and again to make sure they are closed and
set to nothing. This is the part that doesn't make sense. When I step
through these queries in debugger mode, they work great. Even if I place my
cursor at Exit Sub and run the code to the cursor from the beginning, they
run fine. But if not in debugger mode, they fail.

Thanks in advance for the help.


strSQL = "ALTER TABLE ztblImportChurches ALTER COLUMN State LONG;"
DBEngine(0)(0).Execute strSQL, dbFailOnError
strSQL = "ALTER TABLE ztblImportChurches ALTER COLUMN BillState LONG;"
DBEngine(0)(0).Execute strSQL, dbFailOnError
strSQL = "ALTER TABLE ztblImportChurches ALTER COLUMN ShipState LONG;"
DBEngine(0)(0).Execute strSQL, dbFailOnError
strSQL = "ALTER TABLE ztblImportChurches ALTER COLUMN Country LONG;"
DBEngine(0)(0).Execute strSQL, dbFailOnError
strSQL = "ALTER TABLE ztblImportChurches ALTER COLUMN BillCountry LONG;"
DBEngine(0)(0).Execute strSQL, dbFailOnError
strSQL = "ALTER TABLE ztblImportChurches ALTER COLUMN ShipCountry LONG;"
DBEngine(0)(0).Execute strSQL, dbFailOnError

Try putting a line

DoEvents

after each Execute line. It's possible that the first query is still executing
at the time you run the second, and so on.
 

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