PDA

View Full Version : PProblem whith Acces FTP - VBA Code



rcockell
08-29-2014, 12:01 PM
Gentlemen's,

Can anybody please help me with an issue on a vba code in access?

i have a code that uses ftp to dowload a file from a specific computer:

followin the code:

Function fnDownloadFile(ByVal strHostName, _
ByVal strUserName As String, _
ByVal strPassWord As String, _
ByVal strRemoteFileName As String, _
ByVal strLocalFileName As String) As String

'// Set a reference to: Microsoft Internet Transfer Control
'// This is the Msinet.ocx


Dim FTP As Inet 'CtlsObjects.Inet

Set FTP = New Inet 'CtlsObjects.Inet

On Error GoTo Errh
With FTP
.URL = strHostName
.Protocol = 2
.UserName = strUserName
.Password = strPassWord
.Execute , "Get " + strRemoteFileName + " " + strLocalFileName
Do While .StillExecuting
DoEvents
Loop
fnDownloadFile = .ResponseInfo
End With
Xit:
Set FTP = Nothing
Exit Function


Errh:
fnDownloadFile = "Error:-" & Err.Description
Resume Xit
End Function


Every time that i try to use this code i receive an error "error 429 activex component can't create object" on the bold line (check code).

Can anybody please help me to solve or show me an way around to accomplish the goal?? If i maybe has written this question in the wrong area, please just show me the right place that i'll be glad to fix.

Thanks and best regards.

Ps.: I'm using windows 7 and access 2010

ranman256
09-02-2014, 09:09 AM
It usually means you did not checkmark INET control in VBE menu, TOOLS, REFERENCES.