Run Time error '-2147417848 [80010108]' on Connection Refresh

xangetzu

New Member
Joined
Oct 23, 2017
Messages
3
Good afternoon. I have been trying to find a workaround for this, and am at the point of pulling my hair out.
I have what I consider to be a very simple macro. All it does is refresh a number of connections that are in my excel file. All of these connections are to the same access database. The original macro was a loop that handled all connections in the workbook, however as part of troubleshooting I separated it out to specifically reference each one and tried various things to see if I could pin point which connection is the problem, but have had little success. So far, I can determine that it fails on a random connection each time. It does not matter what order I refresh them in, and if I manually refresh them through the connections tab in Excel, they all refresh fine. I have also found that if I debug, and walk through each step, they will all eventually go. Sometimes it takes 5 or more attempts, but eventually hitting F5, and debug over and over will get it through the entire set.

I am using Excel 2013 pro. The Access database is located on the same drive as the excel file (in fact they are in the same directory)
The DoEvents, and message box lines were added to see if I could tease out anything specific. They are not really n
Code:
Sub Refresh_Queries()
'
' Refresh_Queries Macro
'
'
' Keyboard Shortcut: Ctrl+Shift+R
'
   Calculate
   For Each objConnection In ThisWorkbook.Connections
      objConnection.OLEDBConnection.BackgroundQuery = False
   Next
   ActiveWorkbook.Connections("Connection.Lineup").Refresh
   DoEvents
   MsgBox "Lineup refreshed. Continue to update Queries?", vbOKOnly, "Continue?"
   ActiveWorkbook.Connections("Connection.LPR CName Summary").Refresh
   DoEvents
   MsgBox "LPR refreshed. Continue to update Queries?", vbOKOnly, "Continue?"
   ActiveWorkbook.Connections("Connection.LTS A.CName Summary").Refresh
   DoEvents
   MsgBox "Agent LTS refreshed. Continue to update Queries?", vbOKOnly, "Continue?"
   ActiveWorkbook.Connections("Connection.LTS S.CName Summary").Refresh
   DoEvents
   MsgBox "Supervisor LTS refreshed. Continue to update Queries?", vbOKOnly, "Continue?"
   ActiveWorkbook.Connections("Connection.CXI CName Summary").Refresh
   DoEvents
   MsgBox "CXI Summary refreshed. Continue to update Queries?", vbOKOnly, "Continue?"
   ActiveWorkbook.Connections("Connection.CXI CName Surveys").Refresh
   DoEvents
   MsgBox "CXI Surveys refreshed. Continue to update Queries?", vbOKOnly, "Continue?"
   ActiveWorkbook.Connections("Connection.Ticket CName Cases").Refresh
   DoEvents
   MsgBox "Ticket Cases refreshed. Continue to update Queries?", vbOKOnly, "Continue?"
   ActiveWorkbook.Connections("Connection.Ticket CName Summary").Refresh
   DoEvents
   MsgBox "Ticket Summary refreshed. Continue to update Queries?", vbOKOnly, "Continue?"
   Application.ScreenUpdating = True
   MsgBox "Connections to C.L.O.U.D. finished. Continue to update Queries?", vbOKOnly, "Continue?"
End Sub
 
Last edited by a moderator:

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
I've had some time to play around with this, and thought I might be able to use the On Error GoTo [Label] command in conjunction to On Error GoTo -1. But I can not cause it to loop over and over again until it succeeds. It seems no matter what once it repeats a second time and fails, I get the error, and a debug option. Is there anyway to infinitely loop a command until it succeeds? I realize that under nearly all circumstances, this is probably a bad idea, but since repeating the step will eventually lead to it succeeding, I am willing to use it here.
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,849
Members
452,361
Latest member
d3ad3y3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top