check for network connection

A

Anthony

I have a database where the tables are on a remote MS SQL server. I have to
connect to the server when I start the DB. Is there a command in VB you can
use the will check some Microsoft O/S flag to tell you if you are connected
to a network?Right now what I am doing is trying to connect to the network,
if it tries for 30 seconds and can't connect, it gives me an error # that I
use to tell if I am connected to the network. It would be nice if there was
a O/S flag that was set/not set when you are not connected to a network,
without having to first try to connect to the network. That way, you can
save 30 seconds trying to connect.

Thanks
 
A

Anthony

Thanks. I don't know if mapped drives it what I want. I want to know if I
am connected to the LAN/WAN regardless of whether I have any mapped network
drives.
 
D

Daniel Pineault

You could use the code found at

http://vbnet.mvps.org/index.html?code/network/isnetworkalive.htm

to test your network connection. Did it for me instantaneously!

Another alternative is to perform a dir() check of a known path on the
network, but then you still have a time out wait, but it isn;t normally 30
seconds. I still think option 1 is a better approach though.
--
Hope this helps,

Daniel Pineault
http://www.cardaconsultants.com/
For Access Tips and Examples: http://www.devhut.net
Please rate this post using the vote buttons if it was helpful.
 
A

Anthony

Thanks. After writing my original note, I was search some more and came
across a response written by the VB genius Douglas Steele. His response
pointed me to that website also. The code on the website needs quite a bit
of tweaking to work because it is not written for use in Access. Field names
are referred to differently in Access, you need to be careful on the order
of the code posted to the form and you need to have some "know-how" on
creating a form and matching the VB field names with the form field names.
Bottom line: I used the code, did the tweaking and it works. This will help
a lot.

Thanks.
 
P

pietlinden

Thanks.  After writing my original note, I was search some more and came
across a response written by the VB genius Douglas Steele.  His response
pointed me to that website also.  The code on the website needs quite abit
of tweaking to work because it is not written for use in Access.  Fieldnames
are referred to differently in Access,  you need to be careful on the order
of the code posted to the form and you need to have some "know-how" on
creating a form and matching the VB field names with the form field names..  
Bottom line:  I used the code, did the tweaking and it works.  This will help
a lot.

Well, that's because Access VBA and VB6 libraries are *different*. No
control arrays in Access, etc. And Randy uses Controls arrays all the
time in his code. Once you figure out how to get around that,
everything gets MUCH easier.
 
A

Anthony

One thing I noticed after creating the network connection tester, it takes
about 2 minutes for the tester to recognize I have an active connection.
Even worse, it takes about 3 minutes for it to recognize I have LOST my
connection. Would anyone know how to speed up that process?

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top