Using MS Access VBA to upload a folder to FTP Server

Advertisement

itcan
Joined:
Posts:
3

Using MS Access VBA to upload a folder to FTP Server

I have an MS Access Application that makes a daily backup of the data files. During the process a folder is created on the LAN Server and the required data is copied to that folder. After the data is copied to the applicable folder we want the new folder to be uploaded to an FTP Server automatically.
I have the following code that I am battling with:

Private Sub btnDailyExport_Click()
    
Const ftpApp As String = """C:\Itcan\XXXX\bin\ftp\pscp.exe"""
    
    Dim strCmd As String
    Dim gUser As String
    Dim gPass As String
    Dim gHost As String
    Dim gFile As String
    Dim ftpSource As String

    ftpSource = "V:\Itcan\Backup\Daily Export\"

    gUser = "abcdefg"
    gPass = "123456789"
    gHost = "123.123.0.0:\root\foldername"
    gFile = ftpSource       'the folder name where the backup was made on the LAN Server
    
    strCmd = ftpApp & " -sftp -p -r " & gUser & " -pw " & gPass & " " & gFile & " " & gHost
    
    Shell strCmd, 1 ' vbNormalFocus '

    msgbox("FTP Done")

End Sub

I am running the latest software in all respects and I have tried just about every suggested solution I was able to find through Google. I have also added the applicable exceptions to the Firewall settings. All I get is a DOS Window that pops up and hangs around for 30 seconds and then closes.

Reply with quote

Advertisement

itcan
Joined:
Posts:
3

Re: Using MS Access VBA to upload a folder to FTP Server

martin wrote:

This is support forum for WinSCP, not pscp.

Consider asking on https://superuser.com/

Well it doesn't not work with WinSCP either. I tried and there is just no way I could Register the dll. I then ended up with PUTTY and..
If you have a solution with WinSCP I will gladly try it. Its not which app I use to achieve the goal that is important here.

Reply with quote

martin
Site Admin
martin avatar

Re: Using MS Access VBA to upload a folder to FTP Server

itcan wrote:

and there is just no way I could Register the dll.
Means what? What did you try? What errors did you get?

Reply with quote

itcan
Joined:
Posts:
3

Re: Using MS Access VBA to upload a folder to FTP Server

martin wrote:

itcan wrote:

and there is just no way I could Register the dll.
Means what? What did you try? What errors did you get?

Got it sorted the hard way - about 10 hours of trying things but i got it done.
It might be useful to other users to know that to register the dll in Windows 10, even though your .net version is 4.0xxxx use v3.5 in the command line.

Reply with quote

Advertisement

You can post new topics in this forum