Transfer PDF file to ftp server in MS access 2007

2019-09-03 02:54发布

问题:

I'm attempting to upload a pdf file to an ftp server. I've tried this by accessing the wininet dll but unsuccessfully.

What is the best way to do this in MS Access 2007 VB6? I can call a .net dll, but that is my last resort.

Thank you in advance.

回答1:

If you mean VB6 then there's a control you can use for FTP functions. Go to Project/Components and add the "Microsoft Internet Transfer Control" to your project. It's fairly easy to use, but something like...

    Inet.UserName = "Username"
    Inet.Password = "Password"
    Inet.Protocol = icFTP
    Inet.RemoteHost = "123.123.123.123"

    Inet.Execute , "put " & sFileToTransfer & " " & sFilenameOnRemoteHost

    While Inet.StillExecuting
        DoEvents
    Wend

Check Inet.ResponseCode when it finishes

If you mean VBA in Ms/Access then you could write out a small batch file and then shell out to execute it.