Unanswered: Linking Access DB to Excel via MSQuery (VBA Question),
I have a report that is loaded to an access database weekly, and then refreshed through a spreadsheet via MS Query. The report works fine, but I want to add a button to the spreadsheet that will refresh the report since I'm building it for a non-savvy report user. I have included a parameter in the spreadsheet that she will alter, and then want to place a button for her to click to refresh after she inputs the parameter of choice.
Problem is, I keep getting debug errors when I try to run the report. I've used this bit of code before when connecting via an ODBC connection, but it keeps giving me fits when I get to the Query Table.Refresh pointed out below.
Again, the query is connected to a standard access db. Any thoughts?
One issue could be caused by using select/selection, which would be fixed by:
NB. If you are using XL2007 or later (you didn't specify) then the code will be different.
Incidentally, there's no need to have a button here. If you have a range parameter set up, you can right click on the querytable and go to Parameters. You can then tick the "Refresh automatically when cell value changes" checkbox for that parameter.