General ODBC Error on QueryTable.Refresh - potential causes?

JKFEagle

New Member
Joined
Apr 11, 2002
Messages
48
This is probably a real generic problem with about a thousand possible causes but I'm going to ask anyway. I have an Excel file with code that generates the following error:

General ODBC error

The line of code that is generating the error is:

Selection.QueryTable.Refresh BackgroundQuery:=False

Now, I did not write the code and I know at one time it did work. I was hoping someone could help me out so I can zero in on the problem without having to trace out the entire code logic. What typically would give this error? :rolleyes: Thanks in advance to all.
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Re: General ODBC Error on QueryTable.Refresh - potential cau

Well, like you said, there could be many causes to this error. It could be related to invalid SQL syntax, an inability to connect to the table/database, or the table/database could've been changed and fields in the SQL no longer exist, and this is just a few.

Please post some of the "border" code around this line that is causing the error.
 
Upvote 0
Re: General ODBC Error on QueryTable.Refresh - potential cau

Here is the code around the error. What is interesting is that every time it tries to do the Selection.QueryTable.Refresh it crashes and gives the ODBC error regardless of which section it is. Below is a section with two of those lines. Thanks for any help you can give. :oops:


Macro UPDATES THE STOCK DETAIL INFO
Sheets("STOCK").Select
Range("A3").Select
Selection.QueryTable.REFRESH BackgroundQuery:=False
' MACRO UPDATES FILL RATE DATA
Sheets("FILL_RATE").Select
Range("A3").Select
Selection.QueryTable.REFRESH BackgroundQuery:=False
 
Upvote 0
Re: General ODBC Error on QueryTable.Refresh - potential cau

OK yet another bit of info that could be helpful. The refresh commands prior to that one seem to work (different worksheets).
 
Upvote 0

Forum statistics

Threads
1,215,693
Messages
6,126,237
Members
449,304
Latest member
hagia_sofia

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