Check Internet Connection - works at home but not at work!
am 26.11.2007 13:15:17 von u31673
Hi,
I have this code in Access 2003 for checking if an Internet connection is
present: (In the code below, "somedomain" represents the web site that is
used to check for the update. I have substituted other domains in to test it.)
*********************************************************
Private Const FLAG_ICC_FORCE_CONNECTION = &H1
Private Declare Function InternetCheckConnection Lib "wininet.dll" Alias
"InternetCheckConnectionA" _
(ByVal lpszUrl As String, ByVal dwFlags As Long, ByVal dwReserved As Long) As
Long
Code in the Form_Load Event:
If InternetCheckConnection("http://www.somedomain.com/",
FLAG_ICC_FORCE_CONNECTION, 0&) = 0 Then
MsgBox "No Internet connection to the update site.", vbOKOnly +
vbInformation, "Help."
else
' do the update check.
endif
************************************************************ *********
It works when I am at home directly connected to the Internet through a cable
modem and router, but when I run it at work where I connect to the Internet
through the LAN I get the "No Internet Connection" message and the update
check does not run. There is an internet connection available at work - that
is where I have typed this.
Is there another way to determine if there is an Internet connection?
Many thanks
Anthony
--
Message posted via http://www.accessmonster.com
Re: Check Internet Connection - works at home but not at work!
am 26.11.2007 14:58:00 von Jens Schilling
Hi,
The last sample code on this site correctly displays that I'm connected via
LAN:
http://vbcity.com/forums/faq.asp?fid=10&cat=Networking
Regards
Jens
biganthony wrote:
> Hi,
>
> I have this code in Access 2003 for checking if an Internet
> connection is present: (In the code below, "somedomain" represents
> the web site that is used to check for the update. I have substituted
> other domains in to test it.)
>
>
> *********************************************************
> Private Const FLAG_ICC_FORCE_CONNECTION = &H1
>
> Private Declare Function InternetCheckConnection Lib "wininet.dll"
> Alias "InternetCheckConnectionA" _
> (ByVal lpszUrl As String, ByVal dwFlags As Long, ByVal dwReserved As
> Long) As Long
>
> Code in the Form_Load Event:
>
> If InternetCheckConnection("http://www.somedomain.com/",
> FLAG_ICC_FORCE_CONNECTION, 0&) = 0 Then
>
> MsgBox "No Internet connection to the update site.", vbOKOnly +
> vbInformation, "Help."
>
> else
>
> ' do the update check.
>
> endif
>
> ************************************************************ *********
>
> It works when I am at home directly connected to the Internet through
> a cable modem and router, but when I run it at work where I connect
> to the Internet through the LAN I get the "No Internet Connection"
> message and the update check does not run. There is an internet
> connection available at work - that is where I have typed this.
>
> Is there another way to determine if there is an Internet connection?
>
> Many thanks
>
> Anthony
--
Gruss
Jens
______________________________
FAQ: http://www.donkarl.com
Re: Check Internet Connection - works at home but not at work!
am 27.11.2007 00:53:26 von u31673
Thanks for your help Jens.
Anthony
Jens Schilling wrote:
>Hi,
>
>The last sample code on this site correctly displays that I'm connected via
>LAN:
>
>http://vbcity.com/forums/faq.asp?fid=10&cat=Networking
>
>Regards
>Jens
>
>> Hi,
>>
>[quoted text clipped - 38 lines]
>>
>> Anthony
>
--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/databases-ms-ac cess/200711/1