Running a BAT file with Access

N

N Welch

I'm trying to run a BAT file to FTP data from an Access application to a
mainframe computer for further processing.

I have created the FTP Script within my Access program - not a problem.

I have created a BAT file outside of Access that resides in a directory on
my harddrive.

When I use the following code and watch the execution in the DOS window, I'm
seeing C:\Documents and Settings\welchn\my documents ... then my BAT file.
The FTP Script file is located in a different directory and it is referred to
in the BAT file.

Shell "cmd.exe /C ""C:\databill\FTPCTI.bat"""

I've tried Shell Environ$("COMSPEC") & "c:\databill\FTPCTI.bat" - no data is
uploaded with this either.

The receiving file on the mainframe is built but no data is being
transferred to it. Yet when I run the cmd.exe outside the Access program and
run the BAT file, everything works fine and data is uploaded to the mainframe
dataset.

What am I doing wrong in Access?

Thanks

Nancy Welch
App Dev
KC IT Central
 
D

David C. Holley

What process creates the data being sent to the mainframe? Logically if the
only issue is that there's no data in the file on the mainframe when run
from within Access, then the problem most likely resides with how the file
is being created and is not an issue with the BAT file per se.

You stated that when you run the file from outside of Access that file is
sent and data uploaded, but there has to be an intermediate process that
pulls the data from Access, which isn't something that I see in the BAT
file.
 
N

N Welch

Yes, there are processes within the Access DB that extracts, creates and
saves the data as a TXT file in a directory on the users PC. I've checked
the data file that was created via Access and the data is there, so the
process by which the data is created is not the problem. The problem is
within running the FTP Script via the BAT file in Access.
 
B

Brad

Nancy,

We have several Access 2007 applications which create output files (mostly
HTML) which we FTP to another server. We employ another tool called
AutoHotKey that is used in conjunction with Access 2007. We learned about
AHK from someone who posted info about it in this forum. AHK is free (open
source) and very easy to use. If you are open to introducing another
component, let me know and I will post more info.

Brad
 
D

David C. Holley

Try implementing the FTP Client mentioned in a post below. Generally
speaking if you can pull something off with something that's all native to
Access you're going to be better off. I'm guessing that there's some sort of
timing issue between the TXT file being created and the BAT file FTPing.
Going with FTP Client should fix your problem.
 
M

mcescher

Try implementing the FTP Client mentioned in a post below. Generally
speaking if you can pull something off with something that's all native to
Access you're going to be better off. I'm guessing that there's some sortof
timing issue between the TXT file being created and the BAT file FTPing.
Going with FTP Client should fix your problem.







- Show quoted text -

Does it work if you do the process by hand? Try logging into the
server and uploading file. Does the upload file have an
extension? .TXT perhaps? Is the server case sensative? Sometimes
"upload" does not equal "Upload"

Hope these things help,
Chris M.
 

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