title: Applying a filter to only show object from longer than 4 months ago In Ms-Access VBA
body: <p>I have a table named "table1" with a field called "Deployment Date" (please forgive the space). in VBA, I'm attempting to apply a filter which will only show objects deployed earlier than 4 months from the current date. here a bit of the code.</p>
  
  <pre><code>Dim str1 As Date
  str1 = DateAdd("M", -4, Now())
  str1 = "=" &amp; str1
  DoCmd.SetFilter WhereCondition:="[Deployment Date]" &amp; "&lt;" &amp; Chr(34) &amp; str1 &amp; Chr(34)
  </code></pre>
  
  <p>Whenever ran, it will deselect all values in the "Deployment Date" Field, but still show all values inside of the field. the field is in the Long Time Format
  Would know how to tweak the code to make this work? thank you all in advance.</p>
  
  <p>EDIT: Updated the code, still doesn't seem to function</p>
  
  <pre><code>DoCmd.SetWarnings True
  Dim str1 As String
  str1 = Format(Date, "Long Time")
  str1 = DateAdd("M", -4, str1)
  str1 = "=" &amp; str1
  DoCmd.SetFilter WhereCondition:="[Deployment Date]" &amp; "&lt;" &amp; Chr(34) &amp; str1 &amp; Chr(34)
  </code></pre>