Hi,
We have an SQL query that uses a stored procedure on our database. For some reason it keeps going into error every few days.
I made the below to refresh the query and try to detect the time for the break, however, coming in this morning to check it, it has errored (msgbox displayed) after 38 hours.
Is there anything built into excel that would cause this?
Thanks in advance
Msgbox was:
Search started at - 23/11/18 15:37:58
Search stopped at - 25/11/188 05:37:57
attempt no. 26809
We have an SQL query that uses a stored procedure on our database. For some reason it keeps going into error every few days.
I made the below to refresh the query and try to detect the time for the break, however, coming in this morning to check it, it has errored (msgbox displayed) after 38 hours.
Is there anything built into excel that would cause this?
Thanks in advance
Code:
Public counter As Long
Public counter1 As Long
Public starttime As String
Sub breaktester()
Application.DisplayAlerts = False
If starttime = "" Then
starttime = Now()
End If
If counter = 0 Then
counter = 1
End If
restart:
On Error GoTo getout
ActiveWorkbook.Connections("MainstreetNZ1").Refresh
counter = counter + 1
counter1 = Format(counter, "0,000")
Application.StatusBar = "Attempt no. " & counter1
GoTo restart
getout:
MsgBox "Search started at - " & starttime & vbNewLine & "Search stopped at - " & Now() & vbNewLine & "attempt no. " & counter
Application.DisplayAlerts = True
End Sub
Msgbox was:
Search started at - 23/11/18 15:37:58
Search stopped at - 25/11/188 05:37:57
attempt no. 26809
Last edited: