Solved

Detecting a network failure.

Posted on 1997-04-16
2
140 Views
Last Modified: 2006-11-17
Hi,

I'm making a Point of Sale program in VB 5.0, with a MS Access Database. My problem is I want a way to have an
event go off when the database is no longer availible (because of a network
failure). If this event went off it would be easy to start a restroration
procedure, instead of having to error protect every access to the database (all done with DAO).
Thanks,
Dave
vbpro@pacbell.net
0
Comment
Question by:vbpro
2 Comments
 
LVL 1

Expert Comment

by:PC-Alex
ID: 1425384
I cannot imagine that there's an event that you can evaluate when the database is no more available. Who should fire it ? You'll always have to check availability on your own. Write one procedure with an "On error Goto" statement that contains a simple access to your database, called before every database access.
0
 
LVL 3

Accepted Solution

by:
ChrisLewis earned 50 total points
ID: 1425385
How about a Test in a Timer with a Global Variable for Database status?Something like this:+----------+----------+In GLobal.Bas+----------+----------+DIM giDatabaseAvailable as Integer+----------+----------+In Main.FRM+----------+----------+sub Timer1_Timer()  On Error Goto Timer1_Timer_Err  'Just a simple test to see if the Access File is available  If LEN$(DIR$(strDatabase)) = 0 THen    '0 Length means no file...    giDatabaseAvailable = False    'Here you could also do something like:    'Call FixNetworkSutff()  Else    giDatabaseAvailable = True  End ifTimer1_Timer_Exit:  Exit SubTimer1_Timer_Err:  Select case err    Case 76  'Invalid Directory (I think...)      giDatabaseAvailable = False    Case ELse      'Other bad things,      giDatabaseAvailable = False  End select  Resume Timer1_Timer_ExitEnd Sub+----------+----------+
Around any Database Call+----------+----------+
  IF giDatabaseAvailable THen    db.DoStuff  Else    MsgBox "Networks looks to be down."  ENd if

+----------+----------+
How about that???CHris  
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now