Need to a delay between two steps in a macro

G

Guest

Hi,

I have created an autoexec macro which imports a bunch of tables and prints
a report to a pdf file. I have it set where it will automatically create the
pdf without user intervention. Then next step in the macro is for access to
run a module. The module contains code which e-mails the pdf file to
someone. The problem is that it actually takes a minute or two for the pdf
file to be created. However, the module runs immediately and will e-mail an
old report rather than the newly created report. I need to find a way to
delay the module from running for a minute or two so that the PDF file is
completely written. It want to set this up as a schedule task to run every
morning at 5:00 am. Can anyone help with finding a way to cause a delay in
my autoexec macro?

Thanks,
 
J

jahoobob via AccessMonster.com

You can't pause a macro. You could have the autoexec macro RunCode. You
have to do it in a round-about way though. The RunCode macro command calls a
Function. You will need to call a sub from the function. You can do
everything from the subroutine. Check the Timer function in VBA help. It
has an example of pretty much what you want to do.
To make it easy convert the autoexec macro to Module by right clicking on the
maco and select save as. You can then add code to this conversion.
Hope this helps,
Bob
 

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