Link to home
Start Free TrialLog in
Avatar of avoorheis
avoorheis

asked on

Trying to ftp files with vba using inet object

I'm having a problem trying to ftp a couple of files to an ftp site. I've selected a reference to Microsoft Internet Transfer Control 6.0 (SP4) and I'm getting the error below:
    Dim ftp As Inet
    Set ftp = New Inet     <--ActiveX component can't create object

Here's the rest of the code:

Function UploadFile() As Boolean

    Dim ftp As Inet
    LocalFileName = "F:\Automation\CustSat Data\CSI Report101707_5299.txt"
    RemoteFileName = "CSI Report101707_5299.txt"
   

    Set ftp = New Inet
    With ftp
        .Protocol = icFTP
        .RemoteHost = "crm.customersat2.com"
        .Execute .URL, "Put " + LocalFileName + " " + RemoteFileName
        Do While .StillExecuting
            DoEvents
        Loop
        UploadFile = (.ResponseCode = 0)
    End With
    Set ftp = Nothing
End Function
ASKER CERTIFIED SOLUTION
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of avoorheis
avoorheis

ASKER

So it's not possible to use the Inet object and with my code example?
try downloading the sampledb from the site and see how it works
Well, I downloaded the sample. It's an Access '97 database, so, if I open as a 97, I can't update (add in the mda file), if I open and convert to Access 2003 I can't add in the mda file because it's written for Access '97. So, I tried coverting both the database and the addin to access 2003...when I tried to add the addin I got an error message, "The add-in could not be installed because it is missing a USysRegInfo table. That was fun.

Do you know if my code will work as is and is just missing some reference, license or ???
i've been using InetTransferLib.mda for quite awhile and had no problem converting to 2003. In fact I just went to http://www.mvps.org/access/modules/mdl0037.htm, downloaded and converted to 2003 no problem.

The only problem I've ever experienced with the addin is when dowloading files larger than 42 mb the app will blow on an overflow error 6. All that has to be done is change the variable to hold download size from data type long to double.
ok, so I finally got the InetTransferLib.mda to work, works fine, BUT, now when I compact my database I get "Microsoft has encountered a problem....."
My database is compacting ok (size is not increasing), but, the .mda file is not (leaves the lock file open). If I remove the reference to the .mda file, then no problem.
any ideas?
Without seeing it, that would be difficult to troubleshoot. Ive not seen that behaviour in my ftp apps.

If you would like for me to have a look, you could post your db, not the library to ee-stuff.com.
did a little more testing and it seems as though the problem lies with just making a reference to an add-in. In other words, if I create an empty database and name it xxx.mda and  then put a reference to it (go to vb, and in the reference menu, browse to the .mda and check it) then I get the problem. So, I doubt it has anything to do with the code, just the fact of adding a reference to the mda. I'll do some more testing and possibly create another question.
went to look at the docs for the mda, Internet transfer library and saw that I should import the code if using access 2k or >, tried that and got it working.

jmoss, did you actually use it as an addin?
Yes I do use as addin
I did some more research and found that you can't use Microsoft Internet Transfer Control 6.0 (SP4) (msinet.ocx) without a license, which is why my original code did not work.