Code to "wait" until resources released

S

Sandy

Hello!

I have code that takes info from three tables (not at the
same time) and puts it into separate Excel spreadsheets.
This is done via creating a temporary table first,
exporting the data and deleting the temporary table.

Problem: The smaller temporary tables delete with no
problem. The larger one, when I try to delete it with
code, returns a "still in use" message.

Is there some kind of code I can include to wait x amount
of seconds before trying to delete the larger temp table?

Any help will be greatly appreciated!

Sandy
 
B

Bruce M. Thompson

I have code that takes info from three tables (not at the
same time) and puts it into separate Excel spreadsheets.
This is done via creating a temporary table first,
exporting the data and deleting the temporary table.

Problem: The smaller temporary tables delete with no
problem. The larger one, when I try to delete it with
code, returns a "still in use" message.

Is there some kind of code I can include to wait x amount
of seconds before trying to delete the larger temp table?

You might want to post your existing code so that we can see exactly what you
are doing. Something else may be causing the problem.
 
S

Sandy

Hello Bruce!

Thanks for your response. I am sure the problem is the
resources are still in use because if I wait for a few
seconds and then run the code to delete the table, it will
delete; thus my request for the code.

Any ideas on the "wait" code?

Sandy
 
B

Bruce M. Thompson

Thanks for your response. I am sure the problem is the
resources are still in use because if I wait for a few
seconds and then run the code to delete the table, it will
delete; thus my request for the code.

Any ideas on the "wait" code?

Insert the following line where you want to allow the system time to process
before continuing:

DoEvents

If that doesn't do it, you can try inserting the same line again to give more
time, but, since I haven't seen your code, I really can't tell you if this is
the proper approach.
 

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