I'm on Office 365.

I created an ODBC connection to Google BigQuery. After selecting the data source as Google BigQuery, I expand "Advanced Options" and there is an option for "SQL Statement (optional)".
I paste my SQL Code in there and run the query, and have it create a table with the results.

I want the data table to refresh with a new SQL code generated from input fields.

I have a user input field for ID, Start Date, and End Date on a separate sheet.
  1. Using VBA, I have the SQL code on that page update from the inputs from the input fields. This code is then copied to the clipboard. (Done).
  2. I would like to then refresh the data table results using the new SQL query (Where I'm stuck).


Right now I have to go to the data table, Query>Edit>Applied Steps>Source>Settings>Replace the code>Re-Run
or Query>Edit>Home Tab>Advanced Editor>Replace Code

To automate this, I'd like to ideally enter the 3 inputs, press button, data table refreshes with new SQL Statement. Done.

Thanks for the help on this.