By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,369 Members | 1,131 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,369 IT Pros & Developers. It's quick & easy.

Get File - FTP

P: n/a
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
Jan 18 '08 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.