Check internet for update

NigelShaw

Registered User.
Local time
Today, 22:14
Joined
Jan 11, 2008
Messages
1,572
Hi,

is there anything around that can check the internet for an updated file on the click of a button? surely there is but i cant find one.....



regs,


Nigel
 
Hi,

is there anything around that can check the internet for an updated file on the click of a button? surely there is but i cant find one.....
l

You didn't state what you need this for but I'm assuming that it's to be called from an Access application.

The way I handle this is by putting a small text file on my web server indicating the most recent update date of the file. This is downloaded to a temporary location on the user's hard drive when s/he turns on the Access application (more about this soon), read into a temporary table and a simple script does the comparison to see if the user has the most recent data. If not, another file is downloaded and imported into the application.

The way I do the text file download is using an application called wget. You can read about this free application here: http://en.wikipedia.org/wiki/Wget and you can find a link on that page to download it.

Because you were not specific about your need, I don't know if this is of any help. If you do plan to use wget, there are a few Access gotchas that you should know about that took me several 2 am nights to work around. I'll let you know if you need my solutions.

There are ways to use FTP or HTTP from Access but when you know how to use wget, it's probably easier and less coding.

SHADOW
 
Hi,

yes its for an access application. i wanted my db to check a web address whe n it started to see if an update was available. ( sort of like getting the file name on the web and checking it against its own name )

regs

Nigel
 
Hi shadow,

i cant even find the download from that wiki site? i followed the link, found the mirror sites and it gives you a list of about 100 files all with no identifying names so i could be downloading anything....

it sounds about right how you do your method as it reads very similar to what im looking for only i cant seem to find the right download...



many thanks


Nigel
 
Hi shadow,

i cant even find the download from that wiki site? i followed the link, found the mirror sites and it gives you a list of about 100 files all with no identifying names so i could be downloading anything....

Nigel

Ok, a fast internet search gave me this:

http://xoomer.virgilio.it/hherold/

There's a big, bold caption that says "If you don't know which version to get: GET THIS ONE" so you can't miss it.

SHADOW
 
Hi

I found one on gnu32. Maybe I'm either behind the times or particularly stupid but,

the files installed make no sense. What exactly do you do with it? I looked through the docs and it didn't seem clear to me. In all honesty, I was looking for some sort of vba link but no, I didn't find one...

Do you reference the files?
How is it implemented?

Many thanks for your help so far
 
Hi

I found one on gnu32. Maybe I'm either behind the times or particularly stupid but,

the files installed make no sense. What exactly do you do with it? I looked through the docs and it didn't seem clear to me. In all honesty, I was looking for some sort of vba link but no, I didn't find one...

Do you reference the files?
How is it implemented?

Many thanks for your help so far

You're trying too hard, Nigel!

-Use this thing from a command line. Make sure you are in the same directory as the wget.exe file.

- Simply type "wget.exe www.myweburl.com/mytextfile.txt" and in a second or so, you'll see the text file pulled off the webserver and put in the directory that contains wget.

It's that simple.

With Access, there are two gotchas that you have to deal with:

1) You can use a shell command such as:


Code:
  Dim db As DAO.Database
  Dim shellstring As String 
 
  shellstring = VBA.Left(Application.CurrentDb.Name, VBA.InStrRev(Application.CurrentDb.Name, "\")) & "wget.exe www.myweburl.com/mytextfile.txt"
  Shell (shellstring)

Note that in the first line, I put the wget file in the same directory as the Access application.

The only problem with that is that Access' shell command is asynchronous, which means that if you need to process the text file by reading it into your application, the program will just march on whether the file took an extra second to download or not and then you have a problem. What I did to solve this is use the ShellAndWait function that you can find here:

http://www.mvps.org/access/api/api0004.htm

So, the last line of code would be replaced by:

ShellWait (shellstring)

2) The next problem that you would never guess (it took me hours to find this) is that no matter what you do, you can't get the file you're downloading to download into the directory that has the wget.exe file, which is what you'd expect to happen. Access will redirect the file into the Default database directory which is usually somewhere in My Documents no matter what you do. What makes it more fun is that each user can set their default directory from the Options in Access.

To get around this problem, you can find out where the directory is like this:

Application.GetOption("Default Database directory")

Of course you have to do a bit of coding to make sure that the user is connected to the internet or the whole application can freeze (remember, the shell and wait is waiting for something to happen that will never happen) or the user may move the Access application to a folder that doesn't contain the wget file. These error-condition checks are relatively easy, though.

That's all!

I hope this helps.

SHADOW
 
Last edited:
Hi,

i'll look at it but i think ive made one of my own!

i have been working on a Internet connection session to read data from my server pages and compare them within my db.

i changed the code around, added a new html page and placed my current version into the html. i then called my routine to check the text and sure enough, it returns my value and matches it against the version i placed in a text box! i can also download right from within access if i want to.

i placed a If Messagebox "would you like to download the update now?" etc etc and it does download straight into a predefined folder within the db folder.

i'll test it for a few more days but i think ive figured my own problem :)




Nigel
 

Users who are viewing this thread

Back
Top Bottom