?
Solved

Detecting a network failure.

Posted on 1997-04-16
2
Medium Priority
?
165 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 100 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month14 days, 4 hours left to enroll

800 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