?
Solved

Trying to ftp files with vba using inet object

Posted on 2007-10-19
11
Medium Priority
?
1,957 Views
Last Modified: 2012-06-27
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
0
Comment
Question by:avoorheis
  • 6
  • 3
  • 2
11 Comments
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 1500 total points
ID: 20110008
0
 

Author Comment

by:avoorheis
ID: 20110056
So it's not possible to use the Inet object and with my code example?
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 20110092
try downloading the sampledb from the site and see how it works
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:avoorheis
ID: 20110333
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 ???
0
 
LVL 18

Expert Comment

by:jmoss111
ID: 20110663
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.
0
 

Author Comment

by:avoorheis
ID: 20113010
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?
0
 
LVL 18

Expert Comment

by:jmoss111
ID: 20113557
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.
0
 

Author Comment

by:avoorheis
ID: 20115439
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.
0
 

Author Comment

by:avoorheis
ID: 20115791
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?
0
 
LVL 18

Expert Comment

by:jmoss111
ID: 20123324
Yes I do use as addin
0
 

Author Comment

by:avoorheis
ID: 20123398
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.
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
Suggested Courses

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question