• FTP via ActiveX (or other) from Access (Access 2000)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » FTP via ActiveX (or other) from Access (Access 2000)

    Author
    Topic
    #388428

    Hi Loungers,

    I hope this question has not been asked before (at least recently. Since SEARCH is disabled, I can’t do my usual check-before-you ask-the-same-bonehead question-(S)HE-asked-question).

    Have any of you had (a favorable) experience with a particular ActiveX object (or other means) to do FTP directly from an Access application (using VBA)? In other words, I have a query’s worth of .JPG photo names (selected from a much larger table) that I wish to be able to FTP to a website. I HAVE been doing this by getting my app to write a text file containing the FTP commands and selected file names. I then close the Access app and execute the script with the command line http://FTP.EXE that comes with Windows 2000. As some of you may know, unfortunately that program is buggy (read: sux, but it wuz free) and it won’t verify file transfer (ie loop back and retry if there was a failure) and I’ve decided that after futzing around with other stand-alone script-based FTP software (like WS-FTP, which is generally good in immediate Windows mode, but also has script bugs (read: sux AND cost a lot of money AND the authors don’t give a rat’s a** about YOUR problems) that if I have VBA control over the process, I’ll get (make) the cleanest, simplest interface, especially for users who DECIDEDLY don’t wish to be initiated into the mysteries of FTP.

    Thanks! Y’all are ALWAYS a lot of help !

    – David

    Viewing 2 reply threads
    Author
    Replies
    • #681831

      You might look at the thread that begins with post 258760 in the VB/VBA forum. It doesn’t answer your question directly, but takes a bit different path.

    • #682155

      David,
      Here is a database with a FTP module.
      I haven’t used it to upload files but I have used it to download from a FTP site.
      I created a form with an example of that.
      Perhaps you can use it to upload your files. The download portion wasn’t too hard to figure out.

      Scott

    • #682262

      Thanks, gents. As always, you’ve gotten me over my “stuck” place. The MSINET.OCX file is on my machine and appears to be super-flexible, in that you simply feed it the desired FTP command and away ya’ go !

      Now all I have to do is reference it and root around and hack up a VBA code block or two to make a full featured FTP thingie with retry and status messages, etc. 😉

      Thanks !

      • #860002

        Did you ever get your code to work? I’m trying to upload a file to a remote FTP site and I have tried using this code, but get an error message that ActiveX Component Can’t Create Object. Would you be willing to share your code with me (that is if you got it to work)? The following is the code I’m trying to use.

        Public Function Uploadtest()
        Dim FTP As Inet
        Set FTP = New Inet
        With FTP
        .Protocol = icFTP
        .RemoteHost = “???.??.??.???”
        .UserName = “kropf”
        .Password = “#####”
        .Execute .url, “Send C:kropf.txt”
        Do While .StillExecuting
        DoEvents
        Loop
        Uploadtest = (.ResponseCode = 0)
        End With
        Set FTP = Nothing
        End Function

        When I click on debug it highlights the line “Set FTP = New Inet”

        Any help you give would be appreciated.

        Thanks.

        Gary Becker
        Kropf Lumber, Inc.
        gwb@kropflumber.com

        • #860161

          The code example you posted looks like most examples I’ve seen – don’t think it’s the code itself causing error. Some MSKB articles with info concerning the Internet Transfer Control (ITC):

          SAMPLE: Internet Transfer Control Samples

          INFO: Limitations of Internet Transfer Control

          As noted in the latter article, there are lots of “issues” involved when using the ITC; see links to other MSKB articles with more info. As alternative to using the control & dealing with various “issues”, there’s the option of using the WinInet APIs directly. As noted in MSKB 233037, “The Microsoft Internet Transfer Control (ITC) is a wrapper of WinInet APIs. … However ITC doesn’t expose all of the functionality available in WinInet. … If a limitation is unacceptable, you can circumvent it by using WinInet APIs directly in Visual Basic.” There are several MSKB articles that provide sample Visual Basic projects using the WinInet APIs for functionality such as FTP file transfers, etc. See:

          SAMPLE: Using FTP WinInet APIs in Visual Basic with SimpleFtp

          SAMPLE: VBFTP.EXE: Implementing FTP Using WinInet API from VB

          Note if you do not have VB installed, you can still download the sample projects and open the project form (.frm) and module (.bas) files in any text editor, the code should work the same in Access. Be aware that the ITC provides a simple-to-use interface for the complexity of the underlying API; a look at the samples will make this evident. Using the WinInet API directly may eliminate error, but would be a lot more work. In reference to Error 429, this may be the result of a control license issue, or other issue. For example, you may have a license for the ITC control on your development machine, but not on the machine using your application (which is likely if the target system does not have MS development tool like VB or ODE/MOD installed – you’d have to package the app using PDW to ensure license distributed with control). For more info on Error 429 see MSKB 200271:

          INFO: How to Diagnose and Resolve Some Automation Errors

          Excerpt: “Error 429 typically occurs when code tries to instantiate an object. This error can be caused in many ways. The following list includes some of the most common scenarios that could cause this error:

          – License information for a particular component is not present.
          – A component is missing or is not registered.
          – A DCOM issue exists.
          – A Packaging and Deployment Wizard (PDW) issue exists.”

          See article for further info & possible fixes. I think this is where your problem lies, not the code per se.

          HTH

        • #860162

          The code example you posted looks like most examples I’ve seen – don’t think it’s the code itself causing error. Some MSKB articles with info concerning the Internet Transfer Control (ITC):

          SAMPLE: Internet Transfer Control Samples

          INFO: Limitations of Internet Transfer Control

          As noted in the latter article, there are lots of “issues” involved when using the ITC; see links to other MSKB articles with more info. As alternative to using the control & dealing with various “issues”, there’s the option of using the WinInet APIs directly. As noted in MSKB 233037, “The Microsoft Internet Transfer Control (ITC) is a wrapper of WinInet APIs. … However ITC doesn’t expose all of the functionality available in WinInet. … If a limitation is unacceptable, you can circumvent it by using WinInet APIs directly in Visual Basic.” There are several MSKB articles that provide sample Visual Basic projects using the WinInet APIs for functionality such as FTP file transfers, etc. See:

          SAMPLE: Using FTP WinInet APIs in Visual Basic with SimpleFtp

          SAMPLE: VBFTP.EXE: Implementing FTP Using WinInet API from VB

          Note if you do not have VB installed, you can still download the sample projects and open the project form (.frm) and module (.bas) files in any text editor, the code should work the same in Access. Be aware that the ITC provides a simple-to-use interface for the complexity of the underlying API; a look at the samples will make this evident. Using the WinInet API directly may eliminate error, but would be a lot more work. In reference to Error 429, this may be the result of a control license issue, or other issue. For example, you may have a license for the ITC control on your development machine, but not on the machine using your application (which is likely if the target system does not have MS development tool like VB or ODE/MOD installed – you’d have to package the app using PDW to ensure license distributed with control). For more info on Error 429 see MSKB 200271:

          INFO: How to Diagnose and Resolve Some Automation Errors

          Excerpt: “Error 429 typically occurs when code tries to instantiate an object. This error can be caused in many ways. The following list includes some of the most common scenarios that could cause this error:

          – License information for a particular component is not present.
          – A component is missing or is not registered.
          – A DCOM issue exists.
          – A Packaging and Deployment Wizard (PDW) issue exists.”

          See article for further info & possible fixes. I think this is where your problem lies, not the code per se.

          HTH

      • #860003

        Did you ever get your code to work? I’m trying to upload a file to a remote FTP site and I have tried using this code, but get an error message that ActiveX Component Can’t Create Object. Would you be willing to share your code with me (that is if you got it to work)? The following is the code I’m trying to use.

        Public Function Uploadtest()
        Dim FTP As Inet
        Set FTP = New Inet
        With FTP
        .Protocol = icFTP
        .RemoteHost = “???.??.??.???”
        .UserName = “kropf”
        .Password = “#####”
        .Execute .url, “Send C:kropf.txt”
        Do While .StillExecuting
        DoEvents
        Loop
        Uploadtest = (.ResponseCode = 0)
        End With
        Set FTP = Nothing
        End Function

        When I click on debug it highlights the line “Set FTP = New Inet”

        Any help you give would be appreciated.

        Thanks.

        Gary Becker
        Kropf Lumber, Inc.
        gwb@kropflumber.com

    Viewing 2 reply threads
    Reply To: FTP via ActiveX (or other) from Access (Access 2000)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: