dbTalk Databases Forums  

Check Internet Connection - works at home but not at work!

comp.databases.ms-access comp.databases.ms-access


Discuss Check Internet Connection - works at home but not at work! in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
biganthony
 
Posts: n/a

Default Check Internet Connection - works at home but not at work! - 11-26-2007 , 06:15 AM






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


Reply With Quote
  #2  
Old   
Jens Schilling
 
Posts: n/a

Default Re: Check Internet Connection - works at home but not at work! - 11-26-2007 , 07:58 AM






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:
Quote:
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




Reply With Quote
  #3  
Old   
biganthony via AccessMonster.com
 
Posts: n/a

Default Re: Check Internet Connection - works at home but not at work! - 11-26-2007 , 05:53 PM



Thanks for your help Jens.

Anthony



Jens Schilling wrote:
Quote:
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/For...ccess/200711/1



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.