updating a table: When network is available (1 Viewer)

woknick

Registered User.
Local time
Today, 10:52
Joined
Sep 25, 2004
Messages
85
I have a current database application that is used by our sales team. The information used by the database is pulled from our SQL Server. The problem I am running into is most of our sales staff lack the access to the data source when in the field, but still requires the use of the program. I have thought of creating a standalone version of the program for all users to have on their laptops with a standalone table that is a copy of the information in the SQL server. Is their a way to detect if the data source is available and update the standalone table to reflect the new information? Basically I want my database app to check if the data source on the SQL server is available and update accordantly.

Thanks in advance
 

Moniker

VBA Pro
Local time
Today, 12:52
Joined
Dec 21, 2006
Messages
1,567
Use error checking and trap the "server not available" error. I don't know the error number, but you can easily recreate it by using your computer and attempting to connect to a data source you know doesn't exist. That will give you an error number. Trap that and you're good to go.

On Error GoTo NoServer

<Attempt to connect to server code here>

NoServer:
If err.number = the_error_number_you're_looking_for Then
MsgBox "No Server Available"
Resume Next
Else
MsgBox "This error happened: " & err.number
 

woknick

Registered User.
Local time
Today, 10:52
Joined
Sep 25, 2004
Messages
85
Ill try the code.. Thanks for the help
 

woknick

Registered User.
Local time
Today, 10:52
Joined
Sep 25, 2004
Messages
85
Here is the test code that works.. Thanks for the help

On Error GoTo NoServer
DoCmd.OpenQuery ("qry_vendor_Lookup")
NoServer:
If Err.Number = 3078 Then
MsgBox "No Server Available"
Resume Next
Else
MsgBox "This error happened: " & Err.Number
End If
 

Users who are viewing this thread

Top Bottom