Pass Multiple Parameters to SQL Query


I have 3 parameters that I want to update the available values for, before I send it off to the main queried data for a chart.
The 3 power tables I have created from 3 queries are for ‘Line’, ‘Operation’, and ‘Station’. I want the ability to select multiple lines, operations, or stations, and pass them to the WHERE clause of the the main query and to the sub queries of ‘Line’, ‘Operation’ or ‘Station’.
For instance, I want to select ‘Line 1’ and that filter the available options for ‘Operation’ or ‘Station’. And I want the ability to select ‘Station 10’ and ‘Station 11’, and for that to filter the ‘Line’ and ‘Operation’ to show the available values to select.

Once I have selected the single or multiple values that I want from these 3 tables, I want to pass them to a main query WHERE clause.

I can select multiple values and pass it to a dataset, just fine, but I am looking to pass the values in the dataset to a query and do so dynamically.


Is this possible? How would I make the queries dynamic like what I am looking for?

You’ll have to dynamically create your SQL query’s Where Clauses in a string to have the appropriate number of values in ‘IN’ clauses. Or preferably, the appropriate number of ‘?’ placeholders, with the matching numbers of values in your Prep Query’s value list.