473,320 Members | 1,829 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

How to ftp an Access file to a server from a remote area?

547 512MB
I am involved with government healthcare facilities and have 40 small healthcare facilities in remotes villages that i supervise, here in rural South Africa.
The people are quite computer illiterate and i need to simplify/automate the data transfer process instead of using external drives etc. We have a virtually zero budget for fancy applications, and that's why i use Access.

My plan/problem is:
I would create a backup/zip file on the local machines by the press of a button, manually connect with the internet via 3G, and then ftp one file to a location on a server once a week. The files will then be manually imported into the main application DB on the server by my staff.
This process will then be rolled out to many other rural areas if i can get it to work.
Can this ftp transfer be done via Access 2007 runtime version on their local machines?
Any suggestions? please help.
Dec 8 '10 #1

✓ answered by neelsfer

For anybody else wanting to do this:
I got this code on the net and it works 100% after adapting some of the code as shown below, for access 2007. I also imported the module files into my application, from the zip file on the site.

Expand|Select|Wrap|Line Numbers
  1. 'This code was originally written by Dev Ashish
  2. 'It is not to be altered or distributed,
  3. 'except as part of an application.
  4. 'You are free to use it in any application,
  5. 'provided the copyright notice is left unchanged.
  6. '
  7. 'Code Courtesy of
  8. 'Dev Ashish
  9.  
  10. Private Sub TestFTPUpload_Click()
  11. On Error GoTo ErrHandler
  12.  
  13. Dim objFTP As FTP
  14. Const conTARGET = "ftp://196.xx.xx.xx/directory"
  15.  
  16.   Set objFTP = New FTP
  17.   With objFTP
  18.     .FtpURL = conTARGET
  19.     .SourceFile = vbNullString
  20.     .DestinationFile = "/directory/test.txt"
  21.     .AutoCreateRemoteDir = False
  22.     If Not .IsConnected Then .DialDefaultNumber
  23.     .ConnectToFTPHost "username", "password"
  24.     .UploadFileToFTPServer
  25.   End With
  26. ExitHere:
  27.   On Error Resume Next
  28.   Set objFTP = Nothing
  29.   Call SysCmd(acSysCmdRemoveMeter)
  30.   Exit Sub
  31. ErrHandler:
  32.   MsgBox Err.Number & vbCrLf & Err.Description, _
  33.        vbCritical + vbOKOnly, Err.Source
  34.   Resume ExitHere
  35.  
  36. End Sub
** Edit **
More on this can be found at Modules: Internet Data Transfer Library.
The actual download file (only) can be got from here (FTP prg.zip).

14 3402
NeoPa
32,556 Expert Mod 16PB
It can be done, but it's not straightforward.

If you can provide me decent chapter and verse info then I can help, but the normal level of communication on here where every item of info needs to be pulled like teeth will make helping just too complicated.

Do you think you're up for that? It may take some time putting all the technical info together too, so be warned it's not likely to be a quick fix.
Dec 9 '10 #2
neelsfer
547 512MB
thx for feedback. i was just trying to establish the possibility first. When i am ready i will post the info.
Dec 9 '10 #3
NeoPa
32,556 Expert Mod 16PB
Sounds good.

I may need to get an article sorted out on it all, but that'll obviously depend on time. Articles do take a bit extra for sure.
Dec 9 '10 #4
neelsfer
547 512MB
I will appreciate any information on this "challenge", to see what changes are required in my application
regards
Neels
Dec 9 '10 #5
neelsfer
547 512MB
For anybody else wanting to do this:
I got this code on the net and it works 100% after adapting some of the code as shown below, for access 2007. I also imported the module files into my application, from the zip file on the site.

Expand|Select|Wrap|Line Numbers
  1. 'This code was originally written by Dev Ashish
  2. 'It is not to be altered or distributed,
  3. 'except as part of an application.
  4. 'You are free to use it in any application,
  5. 'provided the copyright notice is left unchanged.
  6. '
  7. 'Code Courtesy of
  8. 'Dev Ashish
  9.  
  10. Private Sub TestFTPUpload_Click()
  11. On Error GoTo ErrHandler
  12.  
  13. Dim objFTP As FTP
  14. Const conTARGET = "ftp://196.xx.xx.xx/directory"
  15.  
  16.   Set objFTP = New FTP
  17.   With objFTP
  18.     .FtpURL = conTARGET
  19.     .SourceFile = vbNullString
  20.     .DestinationFile = "/directory/test.txt"
  21.     .AutoCreateRemoteDir = False
  22.     If Not .IsConnected Then .DialDefaultNumber
  23.     .ConnectToFTPHost "username", "password"
  24.     .UploadFileToFTPServer
  25.   End With
  26. ExitHere:
  27.   On Error Resume Next
  28.   Set objFTP = Nothing
  29.   Call SysCmd(acSysCmdRemoveMeter)
  30.   Exit Sub
  31. ErrHandler:
  32.   MsgBox Err.Number & vbCrLf & Err.Description, _
  33.        vbCritical + vbOKOnly, Err.Source
  34.   Resume ExitHere
  35.  
  36. End Sub
** Edit **
More on this can be found at Modules: Internet Data Transfer Library.
The actual download file (only) can be got from here (FTP prg.zip).
Dec 15 '10 #6
NeoPa
32,556 Expert Mod 16PB
I was very interested to see this Neels. I should say it's a completely different approach to the one I've used.

I looked into the code but noticed early on that I had nothing defined for the FTP class that you use in line #13. Is there a library reference that we should know about setting up?
Dec 16 '10 #7
neelsfer
547 512MB
I also imported the following modules into my application, to make the ftp functional.
(One of the modules is for http)
Perhaps this will make more sense to you now
Attached Files
File Type: zip FTP prg.zip (62.3 KB, 204 views)
Dec 16 '10 #8
NeoPa
32,556 Expert Mod 16PB
In this case, that is a link that is perfectly acceptable to post, so I will add it to your Best Answer post. That way anyone seeing that will have access to the full solution. The code, as your post includes reference to, is provided by Dev Ashish, an Access MVP.

PS. Sorry - I missed your latest post with it in. I will still update the Best Answer post to make it easier for others who come across this thread to find the solution.
Dec 16 '10 #9
neelsfer
547 512MB
My next challenge would probably be set my pc up with dyndns etc, to use as a ftp server. Any suggestions?
Dec 16 '10 #10
NeoPa
32,556 Expert Mod 16PB
I can suggest that you post this question in the Windows forum.

If you like you can post a link in here to the new question too, though I'm afraid I will not be able to help a great deal there, and I don't want to discourage anyone else from getting involved by posting anything in there.

I would say though, that hosting any sort of internet server service on home machines is not generally considered a great idea. It's not always a bad idea necessarily, but there are many reasons why it is more complicated than hiring a server presence set up specifically for the purpose. Principal among these is the upload rate of your link (The A of ADSL stands for Asymetric and means that the upload rate is generally much less than the download rate), and the complication of DNS directing anyone correctly to your machine (Presumably DynDNS has a solution for that assuming it stands for Dynamic DNS). Actually, the last of the three I will mention is probably the hardest for most to deal with, and that's the routing and firewall issues.
Dec 16 '10 #11
neelsfer
547 512MB
The code works fine if i "hard code" the file name to be uploaded in line 20. In line 19 it asks you what file you want to upload and it is then selected from the directory where its kept.
i have changed the code in line 21 to true and false.
I would like the code to take this file as selected in line 19 and then add it to the directory in line 14 without having to specify the name in line 20.
If i use .DestinationFile = "/directory/*.*" in line 20, then it use *.* as the name of the file transferred.
please help
Dec 19 '10 #12
NeoPa
32,556 Expert Mod 16PB
I don't follow. Lines #19 and #20 are as below :
Expand|Select|Wrap|Line Numbers
  1. .SourceFile = vbNullString
  2. .DestinationFile = "/directory/test.txt"
What you say about them makes little sense. If you're talking about code that's different from what's posted then please show what it is you're talking about. My psychic senses aren't that reliable.

To save wasting time completely, I would comment that your line #20 uses forward slashes (/) instead of back slashes (\) which are required for Windows filenames, and that no drive letter is included. What you want to work with in relation to someone choosing a file or folder though, is entirely unclear to me (as you've given me nothing to work with).
Dec 19 '10 #13
neelsfer
547 512MB
This is my problem

Expand|Select|Wrap|Line Numbers
  1. .DestinationFile = "/directory/filename.txt"  
i have to specify this line in the code what the file i am uploading, is called. If i upload a different file, then i must change the description above again.
The code does give you the option to select a file , but then this files name must be named exactly as above

I would prefer to have had something like *.* there, so that i can select the file i want to upload myself and don't have to "hardcode" its name in the above code everytime.

i think this code (line 19)
Expand|Select|Wrap|Line Numbers
  1.  .SourceFile = vbNullString
gives you the option to select the file to be uploaded
It works great except for these limitations.
any suggestions please?
Dec 19 '10 #14
NeoPa
32,556 Expert Mod 16PB
I'll look at this again when it's not so late in the evening. I really have to think about what you are trying to say as it's so short of simple, logical statements, but seems to assume I know what you're trying to say already. I don't, and my tired brain is complaining when I try to read through your post again. I'll see what sense I can make of it tomorrow.
Dec 20 '10 #15

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Philip Lee | last post by:
Dear all, How can I access files in remote file server through my ASP.NET application only, but deny all other users? I have added <identity impersonate="true" userName="test"...
7
by: Ronald S. Cook | last post by:
In my .aspx page, I am trying to read file that is on a different on the company network. When I map a drive to it and call from within my .aspx page, I get this error:
0
by: Stanley Sin | last post by:
Dear all , How can I remote access SQL server 2000 using vb.net? I don't know how to use ADO.net to remote access database . Any solutions? Thanks in advance. Stanley
6
by: Marc Castrechini | last post by:
This is a classic double hop delegation issue, however its the first time we are setting this up so we are doing something incorrectly. If we run through the IDE or using a localhost path on the...
2
by: olekribu | last post by:
Hi! I'm struggling with the following scenario: I want my asp.net application to be able to create and write to a specific file on a remote file server from a web server. Both servers have...
1
by: AtulTiwari | last post by:
I know that I AM HERE again for this discussion but what can i do? I am very much frustrated that i can't be able to send or post the file to remote server. So can any one Explain me that how can...
7
by: Kurt Jakobsen | last post by:
Hello, I have a client program that I use to access a MySql 5.0 community server. The client can be on the machine where the MySql server is installed or from a remote machine. The client has...
2
by: josephlee | last post by:
Can an Access application running on Terminal Server be accessed by logging in to a remote desktop via a web browser the same as an Access app running on Citrix can be or is it different to that? ...
2
by: | last post by:
Hi all, I have an asp.net 2.0 website that accesses a locally hosted web service. This works fine on servers that are connected to our network. However, I am having a problem with a laptop...
1
by: tanvisethi | last post by:
Hi I have an asp.net web application. I am trying to access files from remote server (on local network) and unfortunately it isn’t working out. Problem is I am not sure if the error is cos the path...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.