running multiple codes

N

ngan

I have a macro that runs several codes...and the last step
is to quit the application...so my macro looks like:

RunCode (function name: function1)
RunCode (function name: function2)
RunCode (function name: function3)
Quit (Options: Save All)

the functions are all db.execute functions (update and
insert).

When the macro gets to the Quit, an error msg comes up
saying the program can't quit while there are VBA running.

I want to quit the program after the functions run. How
do I do that?

Ngan
 
S

Steve Schapel

Ngan,

You could save all your updates and inserts as Update Queries and Append
Queries, and then instead of RunCode actions in your macro, use
OpenQuery actions instead. This will be more efficient, and may also
solve the problem. You could also try the Exit option instead of
SaveAll as the Options argument of the Quit action... assuming you
haven't actually changed the design of any parts of your application in
the meantime.
 
N

Ngan

Thanks for your reply. That works...now I have another
problem.

I'm using the scheduled tasks in Windows 2000. When I
have that code, it does quit Access...but the schedule
task still has the display of "Running". So, if my next
scheduled time for that task is to run, it can't because
somehow windows is still thinking the task is running.

Is this a bug with the scheduled tasks?

The only work around I found is if I make the macro be the
AutoExec...then the task will finish properly.

Weird eh?

Ngan
 
N

Ngan

Never mind. I found the answer. I created a batch file
where i open access and the db and have the extension: /x
macro name

In the macro, I exit access...that worked cuz the
scheduled tasks is finally ending correctly.

Thanks.
Ngan
 

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