Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Detecting lack of internet connections.

Status
Not open for further replies.

bigdavidt

Programmer
Feb 12, 2004
52
US
We have an Access application with a subroutine that posts information to the GeckoBoard cloud service several times a day. Sometimes the connection fails, so I have added code to the subroutine that will make a second and a third attempt so as to minimize the number of fails. Lately I found out that two of the network computers that use the application have had their internet connections disabled on purpose. What can I do to help our application detect this and not try to run the subroutine?

The subroutine is like this:

Public Sub PushToGecko(gURL, payload)
On Error GoTo Err_SomeName

Dim NumOfTries As Long

'Dim objSvrHTTP
Set objSvrHTTP = CreateObject("MSXML2.ServerXMLHTTP")

Dim strT As String

Err_TryAgain:

objSvrHTTP.Open "POST", gURL, False
'MsgBox (payload)
objSvrHTTP.Send (payload)

'MsgBox (CStr(objSvrHTTP.status))

If objSvrHTTP.Status <> 200 Then
Call SendEmail("cbrown@prestwick-group.com", "None", "Dashboard Fail", "None", "One dashboard push has failed. Please fix me." & gURL)
'Call reportFailure("Dashboard fail", "Push to Gecko <> 200")
End If

Set objSvrHTTP = Nothing

Exit Sub

Err_SomeName:

If NumOfTries < 3 And (Err.Number = -2147220975 Or Err.Number = -2147483638 Or Err.Number = -2147012894 _
Or Err.Number = -2147220973 Or Err.Number = -2147012866) Then
NumOfTries = NumOfTries + 1

GoTo Err_TryAgain
End If

'Any unexpected error.
Call LogError(Err.Number, Err.description, "ReorderTrelloCards, cardID " & cardID)
Resume Next

End Sub


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top