[AccessD] A2K: Shell 'discoveries'

Andy Lacey andy at minstersystems.co.uk
Thu Apr 22 11:29:55 CDT 2004


A suggestion Steven. How about creating a file before you Shell, and making
the last line of the batch file delete the file. Then you can Shell followed
by a Do While which checks if the file exists and comes out when it doesn't.
You'd also need a DoEvents inside the loop so it lets the other processing
get a look in. This way you wouldn't need to ask the user if the process had
finished.

-- Andy Lacey
http://www.minstersystems.co.uk 

> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com 
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of 
> Steven W. Erbach
> Sent: 22 April 2004 16:06
> To: Access Developers discussion and problem solving
> Subject: [AccessD] A2K: Shell 'discoveries'
> 
> 
> Dear Group,
> 
> In debugging the custom EDI application I'm writing for a 
> client of mine, I "discovered" a thing or two about using the 
> Shell command to run a DOS batch file.
> 
> The purpose of using the DOS batch file is to start an FTP 
> session and upload a bunch of files to the EDI mailbox. Then, 
> when the batch file is finished, move the files that were 
> uploaded into an archive folder on the server.
> 
> I had tested the batch file from a command prompt and it 
> works just dandy. The EDI documents show up as having been 
> uploaded successfully. However when I used the Shell command 
> in my application I wouldn't see any document names uploaded. 
> Then I'd get the annoying e-mail the next day from the EDI 
> service provider saying that the expected documents weren't received.
> 
> I finally figured out the problem: Access doesn't wait for 
> the batch file to finish. The Shell command just launches the 
> external program, whatever it is, and goes on to the next 
> task. In my case it was moving the EDI documents into an 
> archive folder. Well, Access whisked those files out of the 
> FTP folder so fast that by the time the FTP login was 
> complete (user name, password, and account name) the files 
> were no longer available for uploading. The FTP session 
> didn't fail, as such, there just wasn't anything to send.
> 
> So, I added a MsgBox asking the user to verify that the DOS 
> session had ended before going on to archive the EDI files. 
> Problem solved.
> 
> Sorry if this is tediously obvious, but I haven't ever run a 
> batch file from Access and I have nobody to bounce this stuff 
> off of (nobody off of whom to bounce this stuff?).
> 
> Regards,
>  
> Steve Erbach
> Scientific Marketing
> Neenah, WI
> 920-969-0504
>  
> "Congress is as trustworthy with money as a crack addict who 
> is experimenting with heroin." - Dave Barry
>  
> "Giving money and power to the government is like giving 
> whiskey and car keys to teenage boys." - P. J. O'Rourke
>  
> "Be thankful we're not getting all the government we're 
> paying for." - Will Rogers
>  
> "It could probably be shown by facts and figures that there 
> is no distinctly American criminal class except Congress." - 
> Mark Twain
> 
> -- 
> _______________________________________________
> AccessD mailing list
> AccessD at databaseadvisors.com 
> http://databaseadvisors.com/mailman/listinfo/a> ccessd
> Website: 
> http://www.databaseadvisors.com
> 
> 




More information about the AccessD mailing list