I am trying to pass a parameter to an MS Access query, in Excel Power Query.
I have a query in Access which takes a Single
parameter called View
that acts as a switch to filter the data, such that I only have to maintain one query in the back end but allow for multiple dedicated perspectives on the front end.
I am able to connect successfully to the database in Excel and run parameter-less queries.
When I try to run the View
-parameter query, I am met with error code -2147217904: “No value given for one or more required parameters”:
I am using an OLEDB connection, but I have also tried ‘Access’ and ‘Access (Legacy)’ connections, but in the latter two types there is apparently no selecting queries with parameters; as soon as I add one, the query is no longer present in either browser.
Even with the ‘Access’ connection to a query without parameters, following the official guidance here for specifying parameters with constant values, the parameter options are completely disabled (and it for some, maybe technical, reason unknown to me still identifies it as an OLEDB connection):
My question is simply: is there a way to specify the parameter from the Power Query Editor, maybe like this?
PARAMETERS [View] IEEESingle = 0;
SELECT *
FROM qry_Test
;
Or else would it make sense to set this up in VBA (provided parameters can be passed there), given that I still want users to be able to use the ‘Refresh/All’ button in the ribbon to update the data?
Thanks