title: Excel SQL query parameter behaviour
body: <p>I've created a spreadsheet that simply allows the user to enter a parameter in a cell and a list is shown as a table based on a SQL query with a the parameter.</p>
  
  <p>I have a stored procedure that does a basic select query and has a variable that is set in the where clause like this (I want to be able to do wildcard lookups)...</p>
  
  <pre><code>where @FileID like Data_fileID
  </code></pre>
  
  <p>I then pass the parameter to the variable by setting the SQL Command text on a button click in VBA...</p>
  
  <pre><code>Private Sub UpdateButton_Click()
      With ActiveWorkbook.Connections("FileID_LU").OLEDBConnection
      .CommandText = "EXEC SP_DB_FileLU '" &amp; Range("FileID").Value &amp; "'"
  End With
  Sheet1.Range("UpdateMsg").Value = "Getting data..."
  ActiveWorkbook.Connections("FileID_LU").Refresh
  Sheet1.Range("UpdateMsg").Value = "Here you go..."
  End Sub
  </code></pre>
  
  <p>So the user enters a file ID into a cell that I've named <code>FileID</code>, hits the update button, the connection properties command text box is updated with a new query and then the connection is refreshed.</p>
  
  <p>This seems to work fine with individual file IDs that are definitely in the database, but if I enter <code>5%</code> and hit the update button, I get a list of everything beginning with <code>5</code>, but the query doesn't update after any subsequent updates with different parameters.</p>
  
  <p>If I go to the connection properties, the last query (after the <code>5%</code>)is displayed in the text box, but it hasn't refreshed - if I click refresh the table by right clicking and selecting refresh, I get the results of the last query, but not with the button click.
  My message cell reads 'Here you go...' but the data connection hasn't refreshed.</p>
  
  <p>Why wont it refresh after a wildcard lookup?  </p>