Question : Test for internet connection

Hello Experts,

I have a Access 2003 application that retrieves data from a webpage on click of a button, if the users computer isn't connected to the internet the application will hang. How can I test for a internet connection (of any kind; dial-up, lan, wlan ect.) and if returned false display a msgbox?  

Answer : Test for internet connection

Another way:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
Public Declare Function InternetGetConnectedState Lib "wininet.dll" (lpdwFlags As Long, ByVal dwReserved As Long) As Boolean

Function IsConnected() As Boolean
    Dim Stat As Long
    IsConnected = (InternetGetConnectedState(Stat, 0&) <> 0)
End Function

Sub Test()
If IsConnected Then
   Msgbox "Internet Available"
Else
   Msgbox "Internet Down!"
End If
End Sub
Random Solutions  
 
programming4us programming4us