Solved

Detecting a network failure.

Posted on 1997-04-16
2
163 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

724 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