Thanks John, this seems to be precisely the problem, the loop should kick if
it sees anything starting that text string other than "0" but it doesn't for
some reason.
Here's the entire function, appreciate your feedback
Function UpDateGolf()
On Error GoTo Err_UpDateGolf
Dim sfrunning As Boolean
sfrunning = True
Dim objWeb As Object
Dim nextloop As Long
Dim lngPointer As Long
Dim strHTML As String
Dim strQuote As String
Dim strQuote3 As Long
Dim strReturn As String
Dim strSearchFor As String
Dim strSearchFor2 As String
Dim strURL As String
Dim str As String
Dim iy As Integer
Dim stpLoop As Long
Dim lngearningsStart As Long
Dim lngearningsEnd As Long
Dim lngDateLen As Long
DoCmd.Hourglass True
strURL = "
http://www.pgatour.com/r/stats/current/109.html"
Set objWeb = CreateObject("Microsoft.XMLHTTP")
objWeb.Open "GET", strURL, False
objWeb.send
strHTML = RemoveWhiteSpace(objWeb.responseText)
strReturn = "Uh, oh, problem with the code!"
iy = 1
stpLoop = 300
Do Until iy > stpLoop
DoEvents
strSearchFor = "<td align=""left""><a href=""/players/"
lngPointer = lngPointer + 1
lngPointer = InStr(lngPointer, strHTML, strSearchFor, vbTextCompare)
lngPointer = lngPointer + Len(strSearchFor)
lngPointer = InStr(lngPointer, strHTML, strSearchFor, vbTextCompare)
'this works
strQuote = Mid$(strHTML, lngPointer + Len(strSearchFor), 9) 'this works
strSearchFor = "$"
lngearningsStart = InStr(lngPointer, strHTML, strSearchFor, vbTextCompare)
lngearningsEnd = InStr(lngearningsStart, strHTML, "</td>", vbTextCompare)
lngDateLen = (lngearningsEnd - Len(strSearchFor)) - lngearningsStart
strQuote3 = Mid$(strHTML, lngearningsStart + Len(strSearchFor),
lngDateLen)
str = "UPDATE 2007TourneyResults SET week10 = " & strQuote3 & " WHERE
playerid = '" & strQuote & "'"
CurrentDb.Execute str, dbFailOnError
iy = iy + 1
Debug.Print strQuote
If Left(strQuote, 1) <> "0" Then
Debug.Print strQuote
sfrunning = False
DoEvents
MsgBox "Done!"
Exit Function
End If
Loop
End_UpDateGolf:
Set objWeb = Nothing
DoCmd.Hourglass False
Exit Function