THE DATABASE ENGINE COULD NOT LOCK...

  • Thread starter Thread starter LittlePhil via AccessMonster.com
  • Start date Start date
L

LittlePhil via AccessMonster.com

Someone please help me before i go insane!

I'm getting the error message 3211 the database engine could not lock the
table 'tblUpload' because it is in use by another person or process.

Background;

I'm importing data into a temporary table, this varies in how many columns it
has (and i do different things with it depending on how many columns) so i
delete it each time i import.

I then perform various data quality checks and display the import errors to
the user - the form (with subform in datasheet view) is opened in window mode
acDialog, to halt the code whilst the user decides if they want to continue
importing despite the errors

The problem appears in when i try delete the temporary table after appending
to a "master table"

The really stupid part is that i put an msgbox in just before the delete line
checking that the form had closed (i used isloaded) and suddenly no error!
So i tried a msgbox "" and this works too whats going on???

Thanks for reading!
 
LittlePhil said:
The problem appears in when i try delete the temporary table after appending
to a "master table"

Make sure there are no queries, forms, or controls bound to the temporary
table after appending to the master table. Then use DoEvents to allow
previous operations to finish up, *then* delete the temporary table.
 
Thanks very much for the quick response,

There are definately no forms and no queries running which is why i'm having
such a hard time of it, only the code in my module is running, the previous
form was definately closed (well according to the isloaded property) - just
can't fathom why the problem goes away when i insert an arbitrary message box.
Had the idea that maybe the memory needed time to clear so i inserted a loop
to pause the code for 5 seconds... didn't work. Makes me wanna thump my desk
and scream! why oh why does inserting an msgbox prevent the error!

Anyway I had a timeout, went and washed my dishes and had the idea of setting
the form sourceobject property to "" on form close then reinstating on next
load. For all its a workaround its not ideal because the user is then
modifying a form.

Thanks once again for your assistance!

Phil
 
Back
Top