VB Shell command to run synchronously?

  • Thread starter Thread starter Michael
  • Start date Start date
M

Michael

I have code that executes an image re-formatting program from within Access
(REASON below).

SITUATION:
I run it "successfully" using the Shell command within a AccessVB loop
reading records off of the database one by one.

PROBLEM:
The problem is that this generates dozens of tasks all running (and
conflicting) together since Shell defaults to aysynchronous running. The
tasks eventually sort themselves out and complete but occasionally the sheer
number generates an "out of memory message".

PROBABLE SOLUTION:
I would like each task to complete before the next one is executed, Shell
therefore running synchronously, but I cannot find how to make Shell work
this way.

REASON: I have images stored in .jpg format but when I insert them into an
Access report in this format, an "out of memory error is generated"
(because, I believe, there is a bug in Access that does not release memory
after a format conversion from .jpg to bmp - which Access uses for reports).
I therefore copy the .jpg images into .bmp format and the reports access
these without an "out of memory error".

Help would be appreciated.

Michael.
 
Michael said:
I have code that executes an image re-formatting program from within
Access (REASON below).

SITUATION:
I run it "successfully" using the Shell command within a AccessVB loop
reading records off of the database one by one.

PROBLEM:
The problem is that this generates dozens of tasks all running (and
conflicting) together since Shell defaults to aysynchronous running.
The tasks eventually sort themselves out and complete but
occasionally the sheer number generates an "out of memory message".

PROBABLE SOLUTION:
I would like each task to complete before the next one is executed,
Shell therefore running synchronously, but I cannot find how to make
Shell work this way.

REASON: I have images stored in .jpg format but when I insert them
into an Access report in this format, an "out of memory error is
generated" (because, I believe, there is a bug in Access that does
not release memory after a format conversion from .jpg to bmp - which
Access uses for reports). I therefore copy the .jpg images into .bmp
format and the reports access these without an "out of memory error".

Help would be appreciated.

Try the API solution posted here:

http://www.mvps.org/access/api/api0004.htm
API: Shell and Wait
 
Thanks for this link - I've no problems with the actual display process and
have written a nifty class the deals with importing the images.

It is interesting however that the example in the link uses .bmp and not
..jpg images thus avoiding the memory problems wo which I refered.

Michael.
 
Thank you Dirk,

This filled the bill perfectly - even though in some instances there are
100+ images to process, the time required seems to be dramatically reduced
when the processes run synchronously!

All the best,

Michael.
 
Back
Top