I am using the following VBA Function in Access 2010 to download a file from the Internet. This Function will be used to distribute a new Access Front-End application connected to MySQL Back-End server.
The problem with the code below is, once the file has been downloaded on the remote machine it will remain in cached. Therefore, when the next update is published, it will now be downloaded. It is being pulled from the Cached folder on the local machine.
How to Download A File From Internet using VBA. Get Microsoft Access / VBA help and support on Bytes. Associated Files Download Links. Navigate to a Webpage with VBA; Open URL and Enter Data in Form Using VBA; GetElement in IE. This page contains coding examples for automating Internet Explorer (IE) using VBA. And Properties here: https://msdn.microsoft.com/en-us/library/ms535893(v=vs.85).aspx.
A workaround is to add a unique id at the end of the file name like ' to make it unique each time. Is there any modification to the code below that would force it to download the file from the url link instead of using the Cached folder on the local machine???? See if you can delete the file from the cache first.
Add this declaration to the top of your module where your function is. Private Declare Function DeleteUrlCacheEntry Lib 'wininet.dll' Alias 'DeleteUrlCacheEntryA' (ByVal lpszUrlName As String) As Long Select all Then in your function: strURLParam = 'strFilenameParam = 'C: Temp MyApp.accdb' DeleteUrlCacheEntry strURLParam returnValue = URLDownloadToFile(0, strURLParam, strFilenameParam, 0, 0) Select all.
I would like sample of Access VBA code to automate the downloading of the Australian PostCode zip file and extract the csv file. I believe I can handle the code to import the csv file into an Access table in my project. The Australia Post site is There are 2 files at the site.
The file required is Download the current Postcode book extract file Because the download zip filename periodically changes to reflect the last update, it will be acceptable if the user needs to actually select the file at that point. I have never done any automating of downloading files from the internet so I am hoping someone can help me with a code sample.
I have the required permission from Australia Post to use the downloaded data in my project. Regards, OssieMac. Not worth the trouble of automating the process. Just open the csv file in Excel, save it as and Excel file and then import it into Access via the User Interface. Hope this helps. Doug Robbins - Word MVP, dkratsymbolmvpsdotorg Posted via the Community Bridge 'OssieMac' wrote in message news:.
Email address is removed for privacy. I would like sample of Access VBA code to automate the downloading of the Australian PostCode zip file and extract the csv file. I believe I can handle the code to import the csv file into an Access table in my project. The Australia Post site is There are 2 files at the site. The file required is Download the current Postcode book extract file (pc-book20100525.zip. Actually, there is no need for the save as Excel part as you can Import a csv file directly using the Text File item in Import section of the External Data tab of the Ribbon. Oops, I see that you are still using XP.
That's a pity, because in Access 2007, you can save the steps as a Task which can be exported to Outlook from where you can forward it to other people. Hope this helps. Doug Robbins - Word MVP, dkratsymbolmvpsdotorg Posted via the Community Bridge 'OssieMac' wrote in message news:. Email address is removed for privacy. Thanks for replying Doug.
However, that is what I am doing now and I then have to distribute the update. I am hoping for something that the end users can do through an automated process without my assistance but if it is not possible then maybe what I need to do is to write some more instructions for the users and explain how to perform the operation for themselves.
Regards, OssieMac Doug Robbins - Word MVP dkratsymbolmvpsdotorg Hope this helps, Doug Robbins - Word MVP [email protected] Screen shots by Snagit from www.techsmith.com. I know this is old but I found it when searching for an answer to this question and I am thinking others might find it. Firstly I hope the originator found someone more useful than this Doug guy. How about helpful replies only.
I don't have a finished version to share, I will share when it is though. I can share my current process. I have Excel downloading files at the moment. Most of this will work in Access and then just a sub to import the file. I am thinking thought that there is probably a way to do this in one process, download, read into VBA array and then import with SQL.
So I'll go Google that and come back if I find it. Hope the below helps if anyone finds it.
So I found away to do it. Download file to local drive Import file to VBA Recordset SQL information to Access Table.
Thing that took me the longest was sorting out the schema file. Made it create one as required. Hopefully that will help someone in the future.