Determining When a DOS Command is Finished In Access - BCP

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have an auto hyperlinking process that creates a DOS BAT file that performs
the DIR command and writes it to a text file. The process works great most
of the time but some times Access gets ahead of the DOS command. I need to
find a way to tell if the DOS command has finished or if the DOS window,
which closes after the command is completed, has closed. Possibly if I could
determine the status of a given Window or the presence of a Window that might
be the ticket.
 
There is a better method that shelling out to a .bat file to do this. Look
at the FileSearch object in Access. I think if you replace your DOS shell to
the FileSearch, you will be happier with the result.
 
While the FileSearch is a good way to replace the one thing it does not
address the another thing we use .BAT for. We also use DOS commands to move
files from one folder to another in the same application. How would I
replace the .BAT file that does that.
 
Look up the Move method of the FileSystemObject Object. It will move a group
of files, the MoveFile method moves one file. Between the FileSearch and the
Move, you should be able to replace the .bat files
 
I'd be inclined to use the FileSystemObject for this myself. In general,
however, when you want to wait for an external process to finish, use a
"ShellAndWait" function. There are several versions around, including on
Karl Peterson's VB site at http://vb.mvps.org/ and the Access Web
www.mvps.org.access .
 
That works if you must shell, but if I can accomplish the task without it, I
prefer that approach.
 
Back
Top