Table In Use

G

Guest

Thanks for taking the time to read my question.

I have code that is running a docmd.runsql on a table (Append query). After
I run the query I want to delete the table. I can't becuause the table is
still in use.

Error: 3211, DB could not lock table 'table1' because it is already in use
by another user.

How do I release this table so that I can delete it?

Thanks,

Brad
 
G

Graham R Seach

Brad,

Am I missing something? You want to delete a table just after adding data to
it? That's like making a sandwich, and throwing it away before eating.

I don't know how you're deleting the table, but the following construct
might help you on your way.
On Error Resume Next
Do
DBEngine(0)(0).TableDefs.Delete "tblMyTable"
DoEvents
Loop Until (Err <> 3211)

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
 
G

Guest

Hi Graham,

I forgot one word; "Source" table. I want to delete the source table after
appending the data to another table.

I got it figured out. I put the code in a different sub that gets fired
after the sub that I was in, is done.

Thanks for your help,

Have a great day,

Brad
 

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