Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FTP Multiple files Using VB

Status
Not open for further replies.

pelagic

Programmer
Nov 7, 2002
97
US
Hi There,

When I download multiple files from FTP site using VB, I got this error message.

Run-time error 35764
Still executing last request.

Could someone please help?

Enclosed is the code.

Dim cn As ADODB.Connection 'connection object
Dim rs As ADODB.Recordset
Dim strPathtoDB As String 'path to database
Dim strCn As String 'string connection
Dim FileName As String
Dim tablename as string

Set cn = New ADODB.Connection
Set rs = New ADODB.Recordset

DoEvents
If LCase$(Left$(HostName, 6)) <> "ftp://" Then HostName = "ftp://" & HostName
frmDownload.InetFTP.URL = HostName

frmDownload.InetFTP.UserName = UserName
frmDownload.InetFTP.Password = Password

strPathtoDB = App.path & "\Download.mdb" 'set the path to database
strCn = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & strPathtoDB
cn.Open strCn 'open database

rs.CursorLocation = adUseClient
rs.Open tablename, strCn, adOpenKeyset, adCmdTable


Do While Not rs.EOF = True
FileName = rs!FILE_NAME frmDownload.InetFTP.Execute , "Get " & FileName & " " & "C:\" & DatabaseName& "\" & FileName

rs.MoveNext
Loop

Closedown:
If Not cn.state = adStateClosed Then cn.Close 'close connection
If Not rs.state = adStateClosed Then rs.Close 'close recordset
Set cn = Nothing 'reclaim memory
Set rs = Nothing 'reclaim memory

 
You might take a look at this thread and see if it helps: thread222-1285729
 
I don't believe that the Inet control's Execute method is synchronous. You probably have to handle the StateChanged event detect request compeltion there before starting each new request.
 
I don't think anyone should use the Inet control anyway.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top