Question Find if a Network Server is on

AliyuKatsina

Registered User.
Local time
Tomorrow, 00:16
Joined
Dec 31, 2009
Messages
73
Hi,

My DB is split into BE and FE into about 5 Laptops. The DB is for entering personal information of pensioners.
sometimes it becomes necessary to take a computer away from the office to capture data of sick and aged pensioners. Now if you take the server (BE) out all the other clients (FE) will not work, and if you take a client out it wont work.
To solve the issue I decided to install a standalone version of the db in all the clients. If out of the network, the standalone DB is used and later captured data to betransfered to the server.
My question: Is there a code that I can use to check if my server is available to start the FE or if unavailable to start the standalone?
Please Help.:banghead:
 
My question: Is there a code that I can use to check if my server is available to start the FE...

The ping.exe command comes to mind...

Code:
ping.exe hostname

Where hostname is the name of the database server.

Try it at the Command Prompt, then script it into VBA. You will need to capture its output into a temp file, then process the temp file to determine if ping.exe was able to contact the remote server or not.
 
Thank you Michael. I have used the ping command alot at the dos command prompt, but how can I script it? I have not done so before. On the other hand is there a VBA command or function to find the hostname?
 
In this post http://www.access-programmers.co.uk/forums/showthread.php?t=227871 I have some code that I run from a routine that is executed at startup from an Autoexcec macro, before any forms come up. It attempts to relink the tables and if it fails, it stops the application.

You could amend it so that it first attempts to relink with the backend at a predefined location on the network server. If that fails then it could relink with the local backend in some predefined location on the user's computer.

Use the above with caution and test a small version on just one table first. I do not know what timeout there is on a reconnect attempt - it could be substantial.
 
Last edited:
Thanks Michael and Spikepl.
As we are using an open wifi to connect, I just created a function that uses the Dir command. so I just Dir the BE file, If it returns a zero string then no network so open standalone file, else do nothing.
My next task is to create an Autoexec macro to do just that.
Please help.
 
My next task is to create an Autoexec macro to do just that.

I would suggest putting code in a form, then configure the DB to open the form upon the DB opening. I prefer a 1-liner Autoexec macro to open the default form... as to disable the behavior I only need to rename the Audoexec macro.

Once application startup / bootstrap has been completed, I chain on from the startup form to the first application form. That way the application may close the first real form and then reopen it later without re-envoking all of the unique startup tasks.
 
Thank you very much Michael and Spikepl. I created the form and code and macro and all is working fine.
 
The Dir has a substantial timeout so it is not ideal especially if you are trying to query a lot of machines. Moreover I would have expected an error if the remote server was not available.

Either way I found it is better to use a Ping. However instead of a simple command ping and capturing the output to a text file and analysing, a Windows Management Instrumentation (WMI) ping can be used.

http://www.serverwatch.com/tutorials/article.php/1571771/Testing-IP-Connectivity-With-WMI.htm

WMI is certainly something worth getting familiar with as it can retrieve all kinds of stuff about hardware and drivers. I used it to determine if a standard Windows driver was enabled on a SCSI optical disk system where it was essential to use a proprietary driver to make it work properly.
 

Users who are viewing this thread

Back
Top Bottom