I am running a plasma screen using excel to display data that refreshes every 40 secs. This works fine apart from the fact that the below query bums out every now and then with a run time error. I have tried increasing the time out secs but this doesnt seem to have resolved it.
Is there a way to get this to just skip the rest of the query and continue if it gets this issue without a error msg. That way it could just re run on the next loop.
Sub Max_Plan_Date()
'
' Max_Plan_Date Macro
' Macro recorded 13/02/2007 by Any Authorised Employee
'
Application.StatusBar = "Plan Date being obtained....."
Sheets("PlanDate").Activate
Cells.Delete
'
With ActiveSheet.QueryTables.Add(Connection:=Array(Array( _
"ODBC;DSN=MS Access Database;DBQ=C:\Plasma\Hourly_Update.mdb;DefaultDir=C:\Plasma;DriverId=25;FIL=MS Access;MaxBufferSize=2048;PageTi" _
), Array("meout=5;")), Destination:=Range("A1"))
.CommandText = Array( _
"SELECT dbo_v_max_planned.app_id, dbo_v_max_planned.Expr1" & Chr(13) & "" & Chr(10) & "FROM `C:\Plasma\Hourly_Update`.dbo_v_max_planned dbo_v_max_planned" _
)
.Name = "Query from MS Access Database"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.PreserveColumnInfo = True
.Refresh BackgroundQuery:=False
End With
Range("B2").Copy
Sheets("Dialler Stats").Activate
Range("B1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.StatusBar = False
End Sub
Bookmarks