title: Microsoft Access VBA - Run time error '3075'
body: <p>I've encountered the run time error '3075'. I'm a novice in VBA! >.&lt; Can i know where did it went wrong? I can't solve it...</p>
  
  <p>For e.g, if I enter a name "Sally" into a textbox (txtMainName), upon clicking on the search button the error pops-up. </p>
  
  <p>The error:</p>
  
  <p>Run-time error '3075':</p>
  
  <p>Syntax error(missing operator) in query expression ' And [Main Applicant Name] Like 'Sally'".</p>
  
  <pre><code>Public Sub Search_Record()
  
  Dim stDocName As String
  Dim stLinkCriteria As String
  Dim stLinkCriteria1 As String
  Dim stLinkCriteria2 As String
  
  
      stLinkCriteria = ""
      stDocName = "frmDisplayInfo"
  
      If (Me!txtMainName &lt;&gt; "") Then
          stLinkCriteria1 = "[Main Applicant Name] Like ' " &amp; Me![txtMainName] &amp; "'"
          stLinkCriteria = stLinkCriteria &amp; " And " &amp; stLinkCriteria1
      End If
  
      If (Me!txtIDNo &lt;&gt; "") Then
          stLinkCriteria2 = "[ID No] Like ' " &amp; Me![txtIDNo] &amp; "'"
          stLinkCriteria = stLinkCriteria &amp; " And " &amp; stLinkCriteria2
      End If
  
      '(*This part is highlighted*)
      DoCmd.OpenForm stDocName, , , stLinkCriteria
      DoCmd.Maximize
  
  End Sub
  </code></pre>