FTP upload w/MSINET.OCX: PROBLEM

  • Thread starter Thread starter sard0nicpan
  • Start date Start date
S

sard0nicpan

Guest
I am trying to upload files to an offsite server. I was directed to a piece of code which should have solved the problem, but did not.

I made the reference to MSINET.OCX (in Access 2000), and everything compiles (NO REPORTED ERRORS) just fine ( I call the function from a form). However, when I call the function (illustrated below: ), it goes as far as "Set FTP = New Inet" and then returns to my main module, bypassing the rest of the function. Is there something I have forgotten to do?

My call function is the following:

Call UploadFile(HostName, UserName, Password, LocalFileName, RemoteFileName)



Code:
Function UploadFile(ByVal HostName As String, _
    ByVal UserName As String, _
    ByVal Password As String, _
    ByVal LocalFileName As String, _
    ByVal RemoteFileName As String) As Boolean

    Dim FTP As Inet

    Set FTP = New Inet 'AT THIS POINT, EXECUTION RETURNS TO MODULE
    
With FTP
        .Protocol = icFTP
        .RemoteHost = HostName
        .UserName = UserName
        .Password = Password
        .Execute .URL, "Put " + LocalFileName + " " + RemoteFileName
        Do While .StillExecuting
            DoEvents
        Loop
        UploadFile = (.ResponseCode = 0)
    End With
    Set FTP = Nothing
End Function
 

Users who are viewing this thread

Back
Top Bottom