[AccessD] [dba-Tech] FTP

Stuart McLachlan stuart at lexacorp.com.pg
Thu May 4 18:44:17 CDT 2023


Try this replacement function in the  demo sent earlier.

You need to add another field in usysWeb named WinSCPProg
It should contain something like:
C:\Program Files (x86)\WinSCP\WInSCP.exe

If it doesn't work, can you email me the crendentials for your PureFTPd  server and I'll try to 
work out what is happening.

Function FTPPut(Directory As String, Filename As String) As Boolean
Const q As String * 1 = """"
Dim strEXE As String
Dim strLocalDir As String
Dim strFName As String
Dim strList As String
If Dir(Filename) = "" Then
   MsgBox Filename & " not found!"
   Exit Function
End If
strLocalDir = Left$(Filename, InStrRev(Filename, "\") - 1)
If Len(strLocalDir) = 2 Then strLocalDir = strLocalDir & "\"
strFName = Mid$(Filename, InStrRev(Filename, "\") + 1)
strList = CurrentProject.Path & "\ftpcmds"
Open strList For Output As #1
Print #1, "open ftp://" & DLookup("Login", "usysWEB") & ":" & DLookup("PW", "usysWEB") & 
"@" & DLookup("Site", "usysWEB")
Print #1, "cd " & Directory
Print #1, "lcd " & strLocalDir
Print #1, "binary"
Print #1, "put " & q & strFName & q
Print #1, "bye "
Close #1
strEXE =  q & DLookup("WinSCPProg", "usysWeb") & q & " /console /ini=nul /script=" & q & 
strList & q
ShellWait strEXE, vbNormalFocus  'vbHide
End Function

If you want to see what is going on, comment out the Print #1, "bye" and enter "bye" manually 
in the CLI once you have examined what is happening.



On 4 May 2023 at 16:01, Rocky Smolin wrote:

> Thank you. I have very little hair left.
> 
> On Thu, May 4, 2023 at 3:47PM Stuart McLachlan
> <stuart at lexacorp.com.pg> wrote:
> 
> > On 4 May 2023 at 15:22, Rocky Smolin wrote:
> >
> > > Can WINSCP be used inside of an Access program?
> > >
> >
> > Yes, see
> > https://winscp.net/eng/docs/scripting
> >
> > Combine it with the SHellWait code in the FTP demo I sent
> > previously.   :)
> >
> > Actually, given the issues you are having, I think I'll build  a
> > version that uses WinSCP before I run into the same problem in the
> > future.
> >
> > Stand by!
> >
> >
> >
> >
> >
> >
> > --
> > AccessD mailing list
> > AccessD at databaseadvisors.com
> > https://databaseadvisors.com/mailman/listinfo/accessd
> > Website: http://www.databaseadvisors.com
> >
> -- 
> AccessD mailing list
> AccessD at databaseadvisors.com
> https://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com




More information about the AccessD mailing list