title: Multiple parameter values in one string in access SQL
body: <p>I have an array which can have a different amount of values, depending on the situation. I want to put these values as a parameter in a query in ms access.</p>
  
  <p>The problem is, if I use the following code to generate a parameter, it sends the whole string as one value to the query, which obviously does not return any rows.</p>
  
  <pre><code>Do Until i = size + 1
      If Not IsEmpty(gvaruocat(i)) Then
          If Not IsEmpty(DLookup("uo_cat_id", "tbl_uo_cat", "[uo_cat_id] = " &amp; CInt(gvaruocat(i)))) Then
              If IsEmpty(get_uocat_param) Then
                  get_uocat_param = CInt(gvaruocat(i))
              Else
                  get_uocat_param = get_uocat_param &amp; " OR tbl_uo_step.uo_step_cat = " &amp; CInt(gvaruocat(i))
              End If
          End If
      End If
      i = i + 1
  Loop
  </code></pre>
  
  <p>At the moment I have 'Fixed' it by generating an SQL string and leaving the query out all together.</p>
  
  <pre><code>get_uocat = "SELECT tbl_product.prod_descr, tbl_uo_cat.uo_cat_descr, tbl_uo_step.uo_step_descr" &amp; vbCrLf _
            &amp; "FROM (tbl_product INNER JOIN tbl_uo_cat ON tbl_product.prod_id = tbl_uo_cat.uo_cat_prod) INNER JOIN tbl_uo_step ON tbl_uo_cat.uo_cat_id = tbl_uo_step.uo_step_cat" &amp; vbCrLf _
            &amp; "WHERE (((tbl_uo_step.uo_step_cat) = " &amp; get_uocat_param &amp; ")) " &amp; vbCrLf _
            &amp; "ORDER BY tbl_product.prod_descr, tbl_uo_cat.uo_cat_descr, tbl_uo_step.uo_step_descr;"
  </code></pre>
  
  <p>This is however not very friendly to many changes. So my question is, how do I get the array to send each value as a separate parameter to the query?</p>
  
  <p><strong>Note:</strong> <code>IsEmpty()</code> is a custom function which checks for empty variables in case you were wondering.</p>