QueryTable won't refresh a blank result if Control selected?

scifibum

Well-known Member
Joined
Jul 22, 2004
Messages
503
Hi,

I've got an external data range (query table) on a worksheet that gets it's one parameter from a worksheet cell, and refreshes automatically when the parameter cell changes.

Everything works great when I enter the parameters by pasting or typing them in. If the parameter doesn't match any records in the database, then the query returns a blank result just as it should.

I tried setting up an ActiveX Combo Box control to let me select different parameter values from the drop down. The control is linked to the parameter cell, so when i make the selection, the cell value changes, and the query refreshes.

This works OK except for one thing. When I use the combo box to select a parameter value that does not have any matching records, the query does not refresh. It just sits there if I have background refresh enabled, and if I do not have this enabled then I get an error message:
"The following data range failed to refresh: Query from MS Access Database. Continue to refresh all?"

So I tried a couple of things and eventually I figured out that if I use code to update the parameter, I can select a worksheet cell before I change the parameter value (so the combo box is no longer selected), then it works and returns a blank result when there are no matching records.

What I can't figure out is why the behavior should be different when the control is selected vs. when it's not. As long as the combo box is not selected when the parameter value is updated, then it works.

Just thought I'd see if anyone had an explanation. I suspect it's a bug, but maybe I just can't understand why this is a feature. :)

Thanks in advance.
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).

Forum statistics

Threads
1,147,674
Messages
5,742,541
Members
423,736
Latest member
dracula cyrus

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
Top