Get File - FTP

Get File - FTP

am 18.01.2008 13:19:31 von roy

Hello,

I got the following code from here thanks to the Access experts.I want
to download and upload files from/to a FTP site.

The upload code works without any problems:

Sub TestFTPUpload()
On Error GoTo ErrHandler
'Dim objFTP As InetTransferLib.FTP
Dim objFTP As FTP
Const conTARGET = "ftp://watyxso2"

' Set objFTP = New InetTransferLib.FTP
Set objFTP = New FTP
With objFTP
.FtpURL = conTARGET
.SourceFile = vbNullString
.DestinationFile = "/fort/dime/uas_ff0/DowJ_CC/files/D_stocks.csv"
.AutoCreateRemoteDir = True
If Not .IsConnected Then .DialDefaultNumber
.ConnectToFTPHost "uas_ff0", "uas_ff0"
.UploadFileToFTPServer
End With
ExitHere:
On Error Resume Next
Set objFTP = Nothing
Call SysCmd(acSysCmdRemoveMeter)
Exit Sub
ErrHandler:
MsgBox Err.Number & vbCrLf & Err.Description, vbCritical + vbOKOnly,
Err.Source
Resume ExitHere
End Sub


But I am unable to use the below code during the Get file from the
same FTP site.

Sub TestFTP()
On Error GoTo ErrHandler
'Dim objFTP As InetTransferLib.FTP
Dim objFTP As FTP
'Const conTARGET = "ftp://watyxso2/fort/dime/uas_ff0/DowJ_CC/files/
D_stocks.csv""
Const conTARGET = "ftp://watyxso2"

'Set objFTP = New InetTransferLib.FTP
Set objFTP = New FTP
With objFTP
.UseProxy = True
.FtpURL = conTARGET
.SourceFile = "/fort/dime/uas_ff0/DowJ_CC/files/D_stocks.csv"
.DestinationFile = "C:\MyFiles\Dailystocks.csv"
'If .FileExists Then .OverwriteTarget = True
.PromptWithCommonDialog = True
If Not .IsConnected Then .DialDefaultNumber
.ConnectToFTPHost "uas_ff0", "uas_ff0"
.WriteFTPDataToFile
End With
ExitHere:
On Error Resume Next
Set objFTP = Nothing
Call SysCmd(acSysCmdRemoveMeter)
Exit Sub
ErrHandler:
MsgBox Err.Number & vbCrLf & Err.Description, vbCritical + vbOKOnly,
Err.Source
Resume ExitHere
End Sub

Where am I going wrong during the Get File?

Thanks for all your help.


Roy