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.
![]() |
There are isolated problems with current patches, but they are well-known and documented on this site. |
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 threadAuthorRepliesWSMarkD
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
-
My Simple Word 2010 Macro Is Not Working
by
mbennett555
9 hours, 58 minutes ago -
Office gets current release
by
Susan Bradley
14 hours, 42 minutes ago -
FBI: Still Using One of These Old Routers? It’s Vulnerable to Hackers
by
Alex5723
1 day, 7 hours ago -
Windows AI Local Only no NPU required!
by
RetiredGeek
15 hours, 45 minutes ago -
Stop the OneDrive defaults
by
CWBillow
1 day, 8 hours ago -
Windows 11 Insider Preview build 27868 released to Canary
by
joep517
1 day, 17 hours ago -
X Suspends Encrypted DMs
by
Alex5723
1 day, 20 hours ago -
WSJ : My Robot and Me AI generated movie
by
Alex5723
1 day, 20 hours ago -
Botnet hacks 9,000+ ASUS routers to add persistent SSH backdoor
by
Alex5723
1 day, 21 hours ago -
OpenAI model sabotages shutdown code
by
Cybertooth
1 day, 21 hours ago -
Backup and access old e-mails after company e-mail address is terminated
by
M W Leijendekker
1 day, 9 hours ago -
Enabling Secureboot
by
ITguy
1 day, 16 hours ago -
Windows hosting exposes additional bugs
by
Susan Bradley
2 days, 5 hours ago -
No more rounded corners??
by
CWBillow
2 days, 1 hour ago -
Android 15 and IPV6
by
Win7and10
1 day, 15 hours ago -
KB5058405 might fail to install with recovery error 0xc0000098 in ACPI.sys
by
Susan Bradley
2 days, 17 hours ago -
T-Mobile’s T-Life App has a “Screen Recording Tool” Turned on
by
Alex5723
2 days, 20 hours ago -
Windows 11 Insider Preview Build 26100.4202 (24H2) released to Release Preview
by
joep517
2 days, 15 hours ago -
Windows Update orchestration platform to update all software
by
Alex5723
3 days, 3 hours ago -
May preview updates
by
Susan Bradley
2 days, 15 hours ago -
Microsoft releases KB5061977 Windows 11 24H2, Server 2025 emergency out of band
by
Alex5723
2 days, 6 hours ago -
Just got this pop-up page while browsing
by
Alex5723
2 days, 20 hours ago -
KB5058379 / KB 5061768 Failures
by
crown
2 days, 17 hours ago -
Windows 10 23H2 Good to Update to ?
by
jkitc
1 day, 19 hours ago -
At last – installation of 24H2
by
Botswana12
3 days, 19 hours ago -
MS-DEFCON 4: As good as it gets
by
Susan Bradley
17 hours, 14 minutes ago -
RyTuneX optimize Windows 10/11 tool
by
Alex5723
4 days, 7 hours ago -
Can I just update from Win11 22H2 to 23H2?
by
Dave Easley
2 days, 6 hours ago -
Limited account permission error related to Windows Update
by
gtd12345
4 days, 21 hours ago -
Another test post
by
gtd12345
4 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.