title: Data type mismatch error with FilterOn MS Access
body: <p>I'm completely stumped. This code was working and is currently working on a different database but just stopped on the one I am working on now. It doesn't make sense why I'm getting a "Data type mismatch in criteria" error when I step through the code all the data that populates is correct. I'm getting the error here: <code>FilterOn = True</code>. I don't know how else Debug this code or how to fix it.</p>
  
  <p>Here's the full code for reference:</p>
  
  <pre><code>Me.searchlat = TempVars("user").Value
  Dim strWhere As String
  Dim lngLen As Long
  
   Const conJetDate = "\#mm\/dd\/yyyy\#"
  
   If Not IsNull(Me.searchlat) Then
   strWhere = strWhere &amp; "([workerid] = " &amp; Me.searchlat &amp; " ) AND "
      End If
  
  If Not IsNull(Me.txtStartDate) Then
  strWhere = strWhere &amp; "([Dateassigned] &gt;= " &amp; Format(Me.txtStartDate, conJetDate) &amp; ") AND "
      End If
  
  If Not IsNull(Me.txtEndDate) Then
  strWhere = strWhere &amp; "([Dateassigned]&lt; " &amp; Format(Me.txtEndDate + 1,   conJetDate) &amp; ") AND "
     End If
  
   lngLen = Len(strWhere) - 5
   If lngLen &lt;= 0 Then
   MsgBox "No criteria", vbInformation, "Nothing to do."
   Else
   strWhere = Left$(strWhere, lngLen)
  
   Me.Filter = strWhere
   Me.FilterOn = True
  </code></pre>