So, in short, I need to connect from data to a SQL query. I had not trouble doing this with a fixed query. I however, want that query to update based on values in certain cell. Since the person using it might not be familiar with SQL, Excel, or VBA, I was tasked with making the data update simply with the Excel refresh button. Anyway, super simplifying, I want to run a query like this:
SELECT
column1, column2, column3
FROM
table
WHERE
important_date BETWEEN [A1] and [A2]
AND thing1 IN [list from A3]
AND thing2 = [A4]
I saw this thread here: Excel: Use a cell value as a parameter for a SQL query and it did not seem to answer my question for 2 reason:
One work-around seemed to require that the table itself be pulled into excel. The table in question would contain millions of rows, making his infeasible.
Some suggested a question mark (?) workaround, but entering ? for dates, lists, or strings simply outputted errors.
Given this, is there a possible way for me to do this? If so, how? and finally, if I can, how would I go about dealing with a blank list? For instance, if someone does not list anything in A3, I'd like the query to simply ignore the "AND thing1 in [list from A3] part of the code.
Thank you,