Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Detecting lack of internet connections.

Detecting lack of internet connections.

Detecting lack of internet connections.

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


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


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

RE: Detecting lack of internet connections.

Try looking for error 80072EE7 (-2147012889) being returned - this means DNS failed and is a reasonable indicator that an internet connection is down (MS themselves pretty much do this to show network status in the Windows status bar - they do an DNS lookup of www.msftncsi.com. If that succeeds they then try and GET a file from the looked-up address to be really sure, but just a failed DNS should be good enough in most circumstances)

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close