I would like to put a button on a form that does the following:
Go to an FTP site on the internet, login, and download a text file.
This does not work:
DoCmd.TransferText acImportDelim, , “UserUpdates.txt”, “ftp://www.somesite.com/somefolder/UserUpdates.txt”
I am getting the error “Runtime error 3652 Login failure”.
I tried manually doing the following:
File
Get external data
Import
Look in … FTP Locations
http://www.somesite.com (I think this works because I can see the files on the FTP site)
I select UserUpdates.txt
Import
…and I get the same error message.
I can open an FTP session using IPSwitch or Procomm program and import the file without trouble.
I would like to do it within Access. Should I be looking at using the Microsoft Internet Transfer control or some other utility?
Any and all suggestions welcome.
![]() |
Patch reliability is unclear. Unless you have an immediate, pressing need to install a specific patch, don't do it. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
-
FTP files into AccessXP (AccessXP)
Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » FTP files into AccessXP (AccessXP)
- This topic has 6 replies, 3 voices, and was last updated 21 years, 10 months ago.
AuthorTopicWSaap2
AskWoody LoungerJuly 23, 2003 at 5:23 pm #390900Viewing 1 reply threadAuthorReplies-
WSAlexya1
AskWoody Lounger -
WSaap2
AskWoody Lounger
-
-
WSMarkD
AskWoody LoungerJuly 23, 2003 at 6:01 pm #696181I’d recommend using the MS Internet Transfer Control (ITC), unless you’d prefer tangling with the Windows WinInet API directly – not recommended unless you need some functionality not provided by the ITC. The ITC provides a (relatively) user-friendly wrapper for the WinInet API. Example of use to download file via FTP:
Function ftpDownloadFile(ByVal HostName As String, _
ByVal UserName As String, _
ByVal Password As String, _
ByVal RemoteFileName As String, _
ByVal LocalFileName As String) As BooleanOn Error GoTo Err_Handler
‘ Library: InetCtlsObjects
‘ C:WINDOWSSYSTEM32msinet.ocx
‘ Microsoft Internet Transfer Control (ITC) 6.0 (SP4)
‘ (distributed w/MS develoment tools – redistributable control)Dim FTP As Inet
Dim strMsg As StringSet FTP = New Inet
With FTP
.Protocol = icFTP
.RemoteHost = HostName
.UserName = UserName
.Password = Password
.Execute .URL, “Get ” + RemoteFileName + ” ” + LocalFileName
Do While .StillExecuting
DoEvents
Loop
ftpDownloadFile = (.ResponseCode = 0)
End WithExit_Sub:
Set FTP = Nothing
Exit Function
Err_Handler:
‘ Error handling, etc hereThe function returns True if the operation succeeds. If specified local file already exists, function will fail. You need to set a reference to the MSINET.OCX file as noted. The control is included with MS developer tools, you’d have to distribute it to users who may not have the control installed on their pc. FTP does not support long filenames or spaces. You can use GetShortPathName API function to get MS-DOS 8.3 short file name if necessary. Example:
Declare Function GetShortPathName Lib “kernel32” _
Alias “GetShortPathNameA” _
(ByVal lpszLongPath As String, ByVal lpszShortPath As String, _
ByVal lBuffer As Long) As LongPublic Function apiGetShortPath(ByVal strFileName As String) As String
Dim lngStrLen As Long
Dim strPath As String
strPath = String$(165, 0)
lngStrLen = GetShortPathName(strFileName, strPath, 164)
apiGetShortPath = Left$(strPath, lngStrLen)End Function
Example:
? apiGetShortPath(“C:Program FilesMicrosoft OfficeOfficeMSACCESS.EXE”)
C:PROGRA~1MICROS~1OFFICEMSACCESS.EXEFor more info on using ITC do a MSKB search on “Internet Transfer Control” you’ll find some sample code & downloads that may be useful.
HTH
-
WSaap2
AskWoody LoungerJuly 23, 2003 at 7:12 pm #696200Mark,
Thanks. I found some examples in MSKB. I tried this behind a command button:
Inet3.Execute “ftp://www.somesite.com”, _
“GET UserUpdates.txt C:My DatabasesUserUpdates.txt”
but got the message
Error 35754
Unable to connect to remote hostI checked the properties of the control and am sure the
user name, password are correct. The URL property looks like this
ftp://username:password@www.somesite.com (names changed to protect the innocent.)
protocol property is 2-icFTP
access type 0-acUseDefault
request timeout 60I will copy your code into a function and call it from the command button and see what happens.
In the meantime, I found a good chapter in the Ekedhal book on implementing an FTP client.
Thanks -
WSMarkD
AskWoody LoungerJuly 24, 2003 at 12:16 am #696213(Edited by MarkD on 23-Jul-03 20:16. Added link to MSKB Article.)
Here is example of how I used function in previous reply:
ftpDownloadFile “ftp.nowhere.com”,”markd”,”secretpwd”,”TEST.zip”,”C:ACCESSTEST.ZIP”
(Names changed to protect the guilty.) This command successfully downloaded “TEST.ZIP” file from the FTP site to local PC. You can also stick the ITC control on a form and call its properties/methods that way. I had this note on a test form:
‘ URL must be specified BEFORE UserName & pwd (ref: MSKB 173264)
Recommend check this MSKB article, possible bug involving the order in which URL, Username & password are specified:
HOWTO: Internet Transfer Control Using Username and Password
Here is another link (to MSDN) that may be useful:
Microsoft Internet Transfer Control
HTH
-
WSaap2
AskWoody LoungerJuly 24, 2003 at 12:44 pm #696399Mark,
Thanks for your help. I am able to GET files successfully if they are 8.3 names. I am working on the GetShortPathNames function now. I just found out that not all the users are using AccessXP. It turns out that some still use A97. I am going to make a run-time version to load on their laptops and see if it works.Thanks again.
-
-
-
Viewing 1 reply thread -

Plus Membership
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Get Plus!
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Search Newsletters
Search Forums
View the Forum
Search for Topics
Recent Topics
-
MS Office 365 Home on MAC
by
MickIver
1 hour, 12 minutes ago -
search by picture an not all that’s cracked up to be (Awaiting moderation)
by
Dru Fuksa
2 hours, 50 minutes ago -
Google’s Veo3 video generator. Before you ask: yes, everything is AI here
by
Alex5723
9 hours, 56 minutes ago -
Flash Drive Eject Error for Still In Use
by
J9438
11 hours, 29 minutes ago -
Windows 11 Insider Preview build 27863 released to Canary
by
joep517
1 day, 4 hours ago -
Windows 11 Insider Preview build 26120.4161 (24H2) released to BETA
by
joep517
1 day, 4 hours ago -
AI model turns to blackmail when engineers try to take it offline
by
Cybertooth
8 hours, 28 minutes ago -
Migrate off MS365 to Apple Products
by
dmt_3904
9 hours, 16 minutes ago -
Login screen icon
by
CWBillow
4 hours, 26 minutes ago -
AI coming to everything
by
Susan Bradley
7 hours, 15 minutes ago -
Mozilla : Pocket shuts down July 8, 2025, Fakespot shuts down on July 1, 2025
by
Alex5723
1 day, 20 hours ago -
No Screen TurnOff???
by
CWBillow
1 day, 20 hours ago -
Identify a dynamic range to then be used in another formula
by
BigDaddy07
1 day, 21 hours ago -
InfoStealer Malware Data Breach Exposed 184 Million Logins and Passwords
by
Alex5723
2 days, 8 hours ago -
How well does your browser block trackers?
by
n0ads
1 day, 19 hours ago -
You can’t handle me
by
Susan Bradley
19 hours, 15 minutes ago -
Chrome Can Now Change Your Weak Passwords for You
by
Alex5723
1 day, 11 hours ago -
Microsoft: Over 394,000 Windows PCs infected by Lumma malware, affects Chrome..
by
Alex5723
2 days, 20 hours ago -
Signal vs Microsoft’s Recall ; By Default, Signal Doesn’t Recall
by
Alex5723
1 day, 23 hours ago -
Internet Archive : This is where all of The Internet is stored
by
Alex5723
2 days, 20 hours ago -
iPhone 7 Plus and the iPhone 8 on Vantage list
by
Alex5723
2 days, 20 hours ago -
Lumma malware takedown
by
EyesOnWindows
2 days, 9 hours ago -
“kill switches” found in Chinese made power inverters
by
Alex5723
3 days, 5 hours ago -
Windows 11 – InControl vs pausing Windows updates
by
Kathy Stevens
3 days, 5 hours ago -
Meet Gemini in Chrome
by
Alex5723
3 days, 9 hours ago -
DuckDuckGo’s Duck.ai added GPT-4o mini
by
Alex5723
3 days, 9 hours ago -
Trump signs Take It Down Act
by
Alex5723
3 days, 17 hours ago -
Do you have a maintenance window?
by
Susan Bradley
1 day, 22 hours ago -
Freshly discovered bug in OpenPGP.js undermines whole point of encrypted comms
by
Nibbled To Death By Ducks
2 days, 19 hours ago -
Cox Communications and Charter Communications to merge
by
not so anon
3 days, 21 hours ago
Recent blog posts
Key Links
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.