Solved

Detecting a network failure.

Posted on 1997-04-16
2
147 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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
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…
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…
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…

803 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