pausing a macro

G

Guest

I am using the AutoExec macro to do the following.
1. Empty records out of specific tables.
2. Run a DTS file (from a command prompt) that gets information from a SQL
database and repopulates some of the above tables.

I then run another macro to manipulate the new records and repopulate other
tables.

I would like to include the second macro in the AutoExec macro. Everytime I
try it the second macro runs before the DTS file finishes.

How do I make the second macro wait for the DTS file to finish running?
 
G

Guest

Add code that Creates a temp file in the same location as your database, call
that code just before the dts command starts, the next call in your macro
after the DTS vba code also in your database that loops while that temporary
file exists, have the DTS script delete the temporary file when it finishes,
the loop in your database will stop and the macro then will continue, here is
the code of the loop:

Function Wait_For_DTS()

do while dir(strTempFileName)<> ""
loop

end function
 

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