[AccessD] I ask Bard to write an FTP upload module

Jim Dettman jimdettman at verizon.net
Tue Apr 25 13:44:19 CDT 2023


No, because it is off the beaten path.

There is no .FTP method in the FileSystemObject.

Jim.

-----Original Message-----
From: AccessD On Behalf Of Rocky Smolin
Sent: Tuesday, April 25, 2023 11:27 AM
To: Access Developers discussion and problem solving
<accessd at databaseadvisors.com>
Subject: [AccessD] I ask Bard to write an FTP upload module

I got a popup in Edge - Bear is ready to write code for me.  So I
thought I'd give it a try with the FTP Upload program I'm trying to write.
Said "write a module in VBA to FTP a file to a server"

Below is the original code and my modifications to pick up the arguments
from a table.

It errors out on the line  Set oFTP = CreateObject("FSO.Ftp") 429 - ActiveX
component cannot create object.

The code looks pretty simple, straightforward. Is there a simple,
straightforward fix for this?

MTIA

Rocky


Here's the code that Bard created:

' Original Code
'Declare variables
'Dim oFSO As Object
'Dim oFTP As Object
'Dim strServer As String
'Dim strUserName As String
'Dim strPassword As String
'Dim strLocalFile As String
'Dim strRemoteFile As String

'Set variables
'strServer = "myserver.example.com"
'strUserName = "username"
'strPassword = "password"
'strLocalFile = "C:\Users\YourUserName\Desktop\myfile.txt"
'strRemoteFile = "/myfolder/myfile.txt"

'Create an instance of the FileSystemObject
'Set oFSO = CreateObject("Scripting.FileSystemObject")

'Create an instance of the FTP object
'Set oFTP = CreateObject("FSO.Ftp")

'Open a connection to the FTP server
'oFTP.Open strServer, strUserName, strPassword

'Upload the file
'oFTP.PutFile strLocalFile, strRemoteFile

'Close the connection
'oFTP.Close

And here's the code I modified to pick up the arguments from a table:

'Dim oFSO As Object
'Dim oFTP As Object
'Dim strServer As String
'Dim strUserName As String
'Dim strPassword As String
'Dim strLocalFile As String
'Dim strRemoteFile As String

'Set variables
'strServer = Me.fldHost
'strUserName = Me.fldUser
'strPassword = Me.fldPassword
'strLocalFile = Me.fldFileToUpload
'strRemoteFile = Me.fldDestinationDirectory & Me.fldDestinationFileName

'Create an instance of the FileSystemObject
'Set oFSO = CreateObject("Scripting.FileSystemObject") '

'Create an instance of the FTP object
'Set oFTP = CreateObject("FSO.Ftp")

'Open a connection to the FTP server
'oFSO.Open strServer, strUserName, strPassword

'Upload the file
'oFTP.PutFile strLocalFile, strRemoteFile

'Close the connection
'oFTP.Close
-- 
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