Running Macro with Windows Scheduler and closing dB as final step

L

LeeGeddy

I have the need to run a macro against a database every 2 minutes. The macro
will initially open the db, open a report (to printer), execute an Update
Table Query and finally, close the db.

I have everything working as above, and when I test the macro, it appears to
work as desired (I have saved the macro as a Shortcut and run by double
clicking from icon.

The problem arises when I schedule the macro using Microsoft Scheduled
Tasks. Everything processes until it gets to the Quit command, and I get a
message that
"You can't exit database now. If you're running a Visual Basic module that
is using OLE or DDE, you may need to interrupt the module."
Upon pressing OK, I am presented with
"The RunMacro action was canceled. You used a method of the DoCMD object to
carry out an action in Visual Basic, but then clicked Cancel in a dialog box.
For example, you used the Close method to close a changed form, then clicked
Cancel in the dialog box that asks if you want to save the changes you made
to the form."

The most confusing part is that it runs fine when I double click the icon,
but adding the same command to the Scheduler presents the error.

Any help would be greatly appreciated.
 

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