HTML Grab Refresh

G

Guest

Hey,

I have a sight problem.

When I open the form, a procedure grabs the html from the page specified.
What I need is for this to happen every 20 minutes.
I threw in some code for the _timer event, and everything seemed fine. But.
When I checked the html that was grabbed, it was the exact same.
I even went as far as automatically closing the form, and opening it - as
well as launching internet explorer, loading the page, and then closing
it(all on the form_timer event) Nothing. It will not refresh.

But when I manually close the form and open it again ...the "latest" html
code is presented.

I was wondering if anyone would know how to go about and "refresh" the
procedure with the lastest html code?

Thanks.
-State

Here is the code:

=======/START CODE/========
Dim strUrl As String
Dim strHTML As String
' Initialize the URL to search
strUrl = "http://www.z1035.com/home/lastfive.php"
' Use our GetFromWebpage function to
' retrieve the HTML from the site
strHTML = GetFromWebpage(strUrl)

txtInput.SetFocus
txtInput.Text = ""
txtInput.Value = strHTML

--FUNCTION---

Function GetFromWebpage(URL As String) As String


Dim objWeb As Object
Dim strXML As String

' Instantiate an instance of the web object
Set objWeb = CreateObject("Microsoft.XMLHTTP")

' Pass the URL to the web object, and send the request
objWeb.Open "GET", URL, False
objWeb.Send

' Look at the HTML string returned
strXML = objWeb.responseText
GetFromWebpage = strXML


End Function


======/END CODE/=========
 
G

Guest

Here is the form_timer event:

====/START CODE/====

Dim oIE As Object

Set oIE = CreateObject("InternetExplorer.Application")
With oIE
.navigate "http://www.z1035.com/home/lastfive.php"
.Visible = True
.Refresh
.Quit
End With

DoCmd.Close

Dim stDocName As String

stDocName = "frmCode" 'The name of the form we want to use.

DoCmd.OpenForm stDocName, acViewNormal, acEdit

====/END CODE/====

Thanks.
-State
 
S

Stefan Hoffmann

hi,

State said:
Dim oIE As Object

Set oIE = CreateObject("InternetExplorer.Application")
With oIE
.navigate "http://www.z1035.com/home/lastfive.php"
.Visible = True
.Refresh
.Quit
End With
Take a closer lookt at InternetExplorer.Application in the MSDN:

---
object.Navigate( _
url As String, _
[Flags As Variant,] _
[TargetFrameName As Variant,] _
[PostData As Variant,] _
[Headers As Variant])

Parameters

Flags
Optional. A constant or value that specifies whether to add the resource
to the history list, whether to read from or write to the cache, and
whether to display the resource in a new window. The variable can be a
combination of the values defined by the BrowserNavConstants enumeration.
---

I think you are loading the cached page. Try modifying the Flags parameter.


mfG
--> stefan <--
 
G

Guest

thanks for the rip.

the two flags that I needed are not supported.

navNoReadFromCache
Not currently supported.

navNoWriteToCache
Not currently supported.

I am currently testing out Refresh2 REFRESH_COMPLETELY

---

I tried the nohistory flag, doesnt work. I tried the refresh2 ...doesnt work.

Not sure what to do here.






Stefan Hoffmann said:
hi,

State said:
Dim oIE As Object

Set oIE = CreateObject("InternetExplorer.Application")
With oIE
.navigate "http://www.z1035.com/home/lastfive.php"
.Visible = True
.Refresh
.Quit
End With
Take a closer lookt at InternetExplorer.Application in the MSDN:

---
object.Navigate( _
url As String, _
[Flags As Variant,] _
[TargetFrameName As Variant,] _
[PostData As Variant,] _
[Headers As Variant])

Parameters

Flags
Optional. A constant or value that specifies whether to add the resource
to the history list, whether to read from or write to the cache, and
whether to display the resource in a new window. The variable can be a
combination of the values defined by the BrowserNavConstants enumeration.
---

I think you are loading the cached page. Try modifying the Flags parameter.


mfG
--> stefan <--
 
G

Guest

Got it to work.
I used a known function that clears the cache for a set URL.

For future users: clear the chace using

====/START CODE/====
Private Declare Function DeleteUrlCacheEntry Lib "wininet.dll" Alias
"DeleteUrlCacheEntryA" (ByVal lpszUrlName As String) As Long


form_load()
DeleteUrlCacheEntry "http://www.z1035.com/home/lastfive.php"
end sub


====/END CODE/====

Cheers
-State
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top