PC Review


Reply
Thread Tools Rate Thread

attempt reconnect on connection failure

 
 
New Member
Join Date: Oct 2010
Posts: 1
 
      5th Oct 2010
hi ..

Hoping someone may be able to help me with a database adp front end / sql backend... overnight (during backup, i think) it suffers a loss of connection. I then get the classic runtime error or connection failure modal dialog and I have ot restart the app..

What I would like to do is simply supress/hide the error and attempt a reconnect at every 2 mins.. I have a hidden form that in it's Ondisconnect event I have set the TimerInterval to 12000 in the Onconnect I set it back to 0 and in the OnTimer event I have the following connection code to reconnect..

.. Will this work? If so how may I supress the error dialog..

many thanks..

Private Sub Form_OnConnect()

Set TimerInterval = 0

End Sub

Private Sub Form_OnDisconnect()
On Error GoTo proc_error
With CurrentProject
If Not .IsConnected Then

Call LetConnectionString

End With

ExitProc:
Exit Sub
ProcError:
Set TimerInterval = 12000
Resume ExitProc

End Sub

Private Sub Form_Timer()

Call LetConnectionString

End Sub

Public Sub LetConnectionString()
With CurrentProject
If Not .IsConnected Then
.OpenConnection ("PROVIDER=SQLOLEDB.1;" _
& "INTEGRATED SECURITY=SSPI;" _
& "PERSIST SECURITY INFO=FALSE;" _
& "INITIAL CATALOG=DbName;" _
& "DATA SOURCE=SERVER;" _
& "Use Procedure for Prepare=1;" _
& "Auto Translate=True")
End If
End With
End Sub

Last edited by Tuz-90; 5th Oct 2010 at 01:36 PM..
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Boot failure on first attempt BrianF Windows XP General 12 5th Mar 2007 11:39 PM
Problem using TcpClient - A connection attempt failure Farrukh Hassan Microsoft Dot NET Framework 1 9th Jun 2006 05:15 PM
Remote attempt failure =?Utf-8?B?Um9tZWJveQ==?= Windows XP Work Remotely 1 1st May 2004 08:41 AM
Remote Desktop reconnect failure John Windows XP Work Remotely 0 3rd Mar 2004 03:59 PM
Intermittant Network Failure/Reconnect Rob Gordon Windows XP Networking 1 15th Dec 2003 11:00 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:33 PM.