Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How do I make Access(VBA) stop running code until an external program has finish

113 views
Skip to first unread message

Jeff H

unread,
Jun 19, 2002, 1:48:07 PM6/19/02
to
We have a program that strips data out of report files
that we call from Access. The problem we run into is that
calling the program with Shell or Appactivate will start
the other application, but Access continues running the
function even though the extrnal program has not
finished. The external program is creating a data file
that needs to be loaded into Access so I need Access to
halt execution until the other program is finished. I've
tried all kinds of arguments with the Shell and
Appactivate but none of them seem to work. Is this a bug
with Access or is it not possible to make Access wait?
The only solution we've come up with is to loop in VBA
until the new data file has been written. Any thoughts?
Jeff.

Jon

unread,
Jun 19, 2002, 3:11:47 PM6/19/02
to
In article <101e101c217b9$7808dab0$9be62ecf@tkmsftngxa03>, "Jeff H"
<jhan...@cenlar.com> writes:

Jeff

You need to use several API calls in conjunction -
http://www.mvps.org/access/api/api0004.htm has some sample code.

Jon

Access tips & tricks - http://www.applecore99.com
Microsoft Access webring - http://a.webring.com/hub?ring=microsoftaccess

Geraldo Schneider

unread,
Jul 26, 2002, 10:25:19 AM7/26/02
to
Hi Jeff!
Thoughts #1:(with intervention of the user)
After Shell or Appactivate, put the following:
'DoCmd.OpenForm "MyLittleForm", acNormal, , , , acDialog'.
The acDialog will wait your 'MyLittleForm' until you close
it. This will be done when you click the button 'Close'
or 'Ok' that you have build on them. Ok, for the things
work fine, will be healthy that the outside App that you
started, warns when finished.
Thoughts #2:(automatic)
You said "...The external program is creating a data file
that needs to be loaded into Access...". Ok, after Shell,
you turn on the Timer, setting it Timer interval to a
convenient number, say 10000 (miliseconds). At each 10
seconds the Timer will call a subroutine that wil test a
field value from a file that the external program will
write when finished - field that was initialized with a
value other than the final value.
After detect the final value, don't forget to set the
Timer interval to zero, to stop it.
Ok, that's the options...
Geraldo

Dave

unread,
Jul 26, 2002, 4:47:53 PM7/26/02
to
I've had good results from creating a seperate Sub routine
to run just the SHELL command... and No API calls needed:)

Dave

>-----Original Message-----
>In article <101e101c217b9$7808dab0

>.
>

Test

unread,
Jul 29, 2002, 7:52:31 PM7/29/02
to
test

Dan Artuso

unread,
Jul 30, 2002, 11:07:36 AM7/30/02
to
Hi Geraldo,
Use Shell and wait:
http://www.mvps.org/access/api/api0004.htm

HTH
Dan Artuso, MVP

"Geraldo Schneider" <ge2...@terra.com.br> wrote in message
news:151601c234b0$44fd88f0$b1e62ecf@tkmsftngxa04...

0 new messages