ftp in Access????

S

Scott Burke

I would like to know if Access2000 has any built in FTP commands?
if yes please point me to a sample program.

I find myself in need to ftp a file and I would like to automate it.

Thanks
Scott Burke
 
S

Stuart McCall

Scott Burke said:
I would like to know if Access2000 has any built in FTP commands?
if yes please point me to a sample program.

I find myself in need to ftp a file and I would like to automate it.

Thanks
Scott Burke

Take a look at my [cob]web site. Click to the downloads page and you'll find
an ftp class module. Very simple to use. IIRC I included an example or two.
The database is written in A97 but the class module will port easily.
 
D

Douglas J. Steele

It would probably help Scott if you posted the URL.... <g>

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Stuart McCall said:
Scott Burke said:
I would like to know if Access2000 has any built in FTP commands?
if yes please point me to a sample program.

I find myself in need to ftp a file and I would like to automate it.

Thanks
Scott Burke

Take a look at my [cob]web site. Click to the downloads page and you'll
find
an ftp class module. Very simple to use. IIRC I included an example or
two.
The database is written in A97 but the class module will port easily.
 
S

Stuart McCall

Doh!

http://website.lineone.net/~smsburnley/

Thanks Douglas

Douglas J. Steele said:
It would probably help Scott if you posted the URL.... <g>

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Stuart McCall said:
Scott Burke said:
I would like to know if Access2000 has any built in FTP commands?
if yes please point me to a sample program.

I find myself in need to ftp a file and I would like to automate it.

Thanks
Scott Burke

Take a look at my [cob]web site. Click to the downloads page and you'll
find
an ftp class module. Very simple to use. IIRC I included an example or
two.
The database is written in A97 but the class module will port easily.
 
S

Stuart McCall

Scott

Here's the url:

http://website.lineone.net/~smsburnley/

<standing in corner in disgrace>

Stuart McCall said:
Scott Burke said:
I would like to know if Access2000 has any built in FTP commands?
if yes please point me to a sample program.

I find myself in need to ftp a file and I would like to automate it.

Thanks
Scott Burke

Take a look at my [cob]web site. Click to the downloads page and you'll find
an ftp class module. Very simple to use. IIRC I included an example or two.
The database is written in A97 but the class module will port easily.
 
S

Scott Burke

Hi guys. Thanks for your responce. I found Stuart's FTP code easyer to
follow than any other code so far. However.....

I am sure I copied the code "AS IS" but I am getting an error. Where In the
code would I look to fix it?

Function BASS_FTP(fileToFTP As String, FTPFileName As String)
On Error GoTo TestBASSFTP_Err

DoCmd.Hourglass True
With New FTPClient <=== error "USER-DEFINED TYPE NOT DEFINED"
.ServerName
"FTP://BASSART:[email protected]/TO_BASS/FILENAME.EXT"
.UserName = ""
.Password = ""
.LocalFile = fileToFTP
.RemoteDir = "."
.RemoteFile = FTPFileName
.TransferType = "ASC"

.OpenFTP
.OpenServer
.PutFile
.CloseServer
.CloseFTP
End With
DoCmd.Hourglass False

TestBASSFTP_Exit:
Exit Function

TestBASSFTP_Err:
MsgBox Err.DESCRIPTION, vbCritical
Resume TestBASSFTP_Exit

End Function
 
D

Douglas J. Steele

While I haven't actually downloaded Stuart's solution, the descriptiong says
that it's a Class Module that needs to be included in your application. How
did you add the code from his download into your application?
 
S

Scott Burke

I downloaded the sample .MDB
I copied the module "AS IS" from the sample .MDB to my program.
made the changes to the test function. (you see it below).
I get error.

Sorry Douglas, I did not intent to put you in the middle. I was hoping that
Stuart would see the post and notify "us" that the fix is on his sight.

I will try to posting again. This time I will try under "Stuart".

Thanks
Scott Burke
 
S

Scott Burke

Hi guys. Thanks for your responce. I found Stuart's FTP code easyer to
follow than any other code so far. However.....
I am sure I copied the code "AS IS" but I am getting an error. Where In
the
code would I look to fix it?

Function BASS_FTP(fileToFTP As String, FTPFileName As String)
On Error GoTo TestBASSFTP_Err

DoCmd.Hourglass True
With New FTPClient <=== error "USER-DEFINED TYPE NOT DEFINED"
.ServerName
"FTP://BASSART:[email protected]/TO_BASS/FILENAME.EXT"
.UserName = ""
.Password = ""
.LocalFile = fileToFTP
.RemoteDir = "."
.RemoteFile = FTPFileName
.TransferType = "ASC"

.OpenFTP
.OpenServer
.PutFile
.CloseServer
.CloseFTP
End With
DoCmd.Hourglass False

TestBASSFTP_Exit:
Exit Function

TestBASSFTP_Err:
MsgBox Err.DESCRIPTION, vbCritical
Resume TestBASSFTP_Exit

End Function
 
D

Douglas J. Steele

What do you mean by 'copied the module "AS IS"'?

Did you import it from the sample database, or did you open it in the sample
database, select all of it, copy and paste into your application? If you did
the latter, did you paste it into a Class Module, or just a Module?
 
S

Scott Burke

Open sample database, select all, copy and paste into my application.
Just a module.

I not sure on how to do a Class Module?
I think I will try the import option.

Scott Burke
 
S

Scott Burke

OK.... I used the import function and it worked!!!!!

What is the differance between a "Class Module" and a "Module"?
Why would I use one over the other.

Just a quick explination please.
Scott Burke
 
S

Scott Burke

Hi Stuart, I was able to get you FTP code to work. Now I have an other
problem.
I am fairly sure it is a formating issue.
Objective:
save file "T:\CLEARWIN\FTP\BMS\PCC20060414.TXT" to the ftp server
"Ftpdrop.espn.com" in directory "to_bass".

I keep getting an "FtpPutFile Failed" error.
here is the code:

Function BASS_FTP(fileToFTP As String, FTPFileName As String)

On Error GoTo TestBASSFTP_Err

DoCmd.Hourglass True
With New FTPClient

.ServerName = "ftpdrop.espn.com"
.UserName = "bassart"
.Password = "3xpl01t"
.LocalFile = fileToFTP
Rem Set the remote directory to "TO_BASS"
.RemoteDir = "/to_bass"
.RemoteFile = FTPFileName
.TransferType = "ASC"

.OpenFTP
.OpenServer
.PutFile
.CloseServer
.CloseFTP
End With
DoCmd.Hourglass False

TestBASSFTP_Exit:
Exit Function

TestBASSFTP_Err:
MsgBox Err.DESCRIPTION, vbCritical
Resume TestBASSFTP_Exit

End Function


Scott Burke
 
S

Stuart McCall

Sorry for the delay getting back to you. Been staying with relatives for
Easter.

I see Douglas helped you out re your import method. Yes the contents must
be in a class module, not an ordinary module. The line:
With New FTPClient
creates a new instance of the object called FTPClient (class modules compile
into an object which can have one or multiple instances, all running
indepentently).

Anyhow, instead of:
.RemoteDir = "/to_bass"
try:
..SetDir "/to_bass"
If that fails try:
..SetDir "./to_bass"
Notice the inclusion of a period - some servers need it, others don't.
If you try half a dozen servers, you'll find that they all have quirks.
The only way to solve most of these is "suck it and see".

Also, what are you passing as the FTPFileName parameter?

BTW if that username and password were "real" then I suggest
you change at least the password right now.
 
N

Nick X

Hello,
Sorry to use an old post, but my situation seems similar. I downloaded the
db from http://website.lineone.net/~smsburnley/ and I am getting the
following error:

->MsgBox Err.Description, vbCritical <-error occurs here>
"Call to FtpSetCurrentDirectory failed.. (OS error code =0)
Internet Response:"

I have step through the code and did not get any other errors.

Sub TestFTP1()

On Error GoTo TestFTP1_Err

DoCmd.Hourglass True
With New FTPClient
.ServerName = "ftp.sitename.org"
.UserName = "username"
.Password = "password"
.LocalFile = "c:\temp\"
.RemoteDir = "/Db_Backend"
.RemoteFile = "Utility-Cuts_be.mdb"
.TransferType = "BIN"
.OpenFTP
.OpenServer
.GetFile
.CloseServer
.CloseFTP
End With
DoCmd.Hourglass False

TestFTP1_Exit:
Exit Sub

TestFTP1_Err:
MsgBox Err.Description, vbCritical
Resume TestFTP1_Exit

End Sub

Thanks,
NickX
 
S

Scott Burke

Hi Nick. Simply put this is wrong: .RemoteDir = "/Db_Backend"
1) You miss spelled it
2) It does not exist
3) or they changed your ftp profile and you are allready in "/DB_BACKEND"

Scott Burke
 
N

Nick X

Thanks for your response, I commented out .RemoteDir = "/Db_Backend" and the
error handling script (that's why it wasn't showing me the tue location of
the error) and now the error is showing up at .GetFile "Call to FtpGetFile
failed" so your probably right, maybe it is in my ftp profile.
Thanks
NickX
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top