(Q) How can I use FTP from Access?
(A) With Win95 and NT, you need to use a SCR (script) file with
FTP. Consider this sample sub:
Sub sFTP(stSCRFile As String)
Dim stSysDir As String
stSysDir = Environ$("COMSPEC")
stSysDir = Left$(stSysDir, Len(stSysDir) - Len(Dir(stSysDir)))
Call Shell(stSysDir & "ftp.exe -s:" & stSCRFile, vbNormalFocus)
End Sub
We need to pass FTP.EXE as the program name, not CMD.EXE (under NT) which Environ$("Comspec")
returns. If you want the Dos window to be hidden, you can use vbHide instead
of vbNormalFocus.
Another alternative, which requires you to have Internet Explorer 4.x or
better installed, is to use the WinInet APIs directly. Sample classes are
available in
Internet Transfer Library.
|