Run-time error '1004'

famayag

New Member
Joined
Aug 19, 2011
Messages
1
Help, i'm in troubles when trying to refresh a query table. I never have this problem, but I'm using Excel 2010 file type XLSM

Sometimes works perfect, sometimes is failing, very erratic, however :

Private Sub btnClearFilters_Click()
Range("B1").Value = ""
Range("B2").Value = ""
Dim strSql As String

msgStatusOn ("Refreshing with history sales per item")
strSql = "EXEC dbo.HST_3YR_QuarterlySales 2011, 0, '',''"
Worksheets("Invoice History").Range("Table_Query_from_Sales").ListObject.QueryTable.CommandText = strSql

'----- Here is failing with this message :Run-time error '1004': Application-defined or object-defined error

Worksheets("Invoice History").Range ("Table_Query_from_Sales").ListObject.QueryTable.Refresh BackgroundQuery:=False

'----------------------------------------------
msgStatusOff
PopulateItemCombo
AddTotals

End Sub

Thank you
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.

Forum statistics

Threads
1,216,091
Messages
6,128,772
Members
449,468
Latest member
AGreen17

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