Need Simple FTP Upload Code

Michael3Smith

New member
Local time
Yesterday, 22:45
Joined
Jul 11, 2013
Messages
7
I need some simple code that will copy an Excel file or a table in Access to a specific location on an FTP server. I would think this would be a very simple task, but I have yet to find any sample code that is *simple*:(. I have seen lots of code that requires downloading this dll or that mda and yadda yadda, but the examples don't work. There must be something built into MS Access 2010 that will allow a file to be uploaded to an FTP site. :banghead:

All the variables are known:
The FTP location (it never changes)
The FTP Username and Password (they never change)
The destination folder on the FTP site (it never changes)
The File type (it never changes)
The File name (available from the form in Access from which this will be executed)

I can either produce an output file, then copy it to the FTP site, or I can export the table directly to the FTP site with the file name for that day.

This seems to be a very simple task with no simple solution. Currently I am using an FTP app to get the file to the FTP site, but I would like to automate this. The process that creates the output file is already automated, so I would just like to add this to the existing code as its own module.

I'm looking for a simple command on the idea of:
DoCmd.FTPFile, acExel, TableName, FTPFilePath, FTPFileName, Username, Password, acUpload

Please note that I just made all that above up and none of it is a real function/command in VBA, but is just the kind of thing I'm looking for.

I would think that since I can download and XML file from an FTP site that it should be child's play to upload a simple file to an FTP site, but I can't figure it out.
 
http://access.mvps.org/access/modules/mdl0037.htm
This was suggested on a previous post. I haven't tried it, but it looks like it should work.
Would appreciate your feedback.
It it works, marking the post as Solved would help many others.
If not, please provide feedback.
 
Thanks for the reply. That post is one of the many that I have tried and can't get to work. I can't get the dll to register so I can't use it as a reference, so the code won't compile.
 
Did you find an answer? I've been searching for hours and still can't get it to work.
 
1. If normal FTP is required, you can use the windows built-in ftp client to login and put a file on the ftp server.

2. All the ftp commands can be written into a .BAT file from you application

3. the .bat file can be executed using the Shell command (look it up in the docs)

4. Done.

IF you need secure FTP then download the free WinSCP . For that you can two files - a .BAT file to run the WinSCP and a file containing the commands to be fed into the WinSCP application.
 
I can't do any file transfers via batch file. I can connect to the ftp server but get kicked out whenever I try to upload.
 
I can't do any file transfers via batch file.

and

I can connect to the ftp server but get kicked out whenever I try to upload.

What is the connection between these two sentences?

If you can connect can you manually upload a file or not. If you can, what is the specific problem with a batch file containing the same commands? If not, then you probably have no write permissions on the ftp server.
 

Users who are viewing this thread

Back
Top Bottom