title: Ms Access VBA - Using Like with textbox value
body: <p>Just having a little trouble using the Like operator with strSQL in vba for ms access. Currently i have a form that when textboxes are filled in, the listboxes rowsources are re-queried using the value of a textbox. Most of these work perfectly, except when i attempt this strSQL query:</p>
  
  <pre><code>SelectedContract = Me.List4.Column(0)
  StreetInitial = Text6 + "*"
  Dim ConId As Integer
  ConId = DLookup("[id]", "[Portal Contract]", "[contract_no] = """ &amp; SelectedContract &amp; """")
  
  
  Dim selectParas As String
  selectParas = "SELECT a.street, a.mh1, a.mh2, a.diameter, a.thickness, a.parameters_id, a.installation_date " &amp; _
                " FROM [Portal Sample] As a WHERE a.contract_id = " &amp; ConId &amp; " And a.street Like '*" &amp; StreetInitial &amp; "*';"
  
  Me.List9.RowSource = selectParas
  Me.List9.Requery
  </code></pre>
  
  <p>Text6 prompts the user for the street initial, and i am trying to search all entries that start with that initial. I tried appending * to the string to see if the Like in the selectParas statement would treat it as the special character and only search for entries beginning with text6 with any following characters, but it doesn't seem to be working, and returns all entries that just contain the character in Text6.</p>