title: Why this filter is not working properly in MS Access
body: <p>I have this code in VBA:</p>
  <pre><code>FilterString = &quot;CalanderDate&lt;#&quot; &amp; EndOfWeek(InDate) &amp; &quot;# AND CalanderDate &gt;#&quot; &amp; StartOfWeek(InDate) &amp; &quot;#&quot;
  Me.Filter = FilterString
  Me.FilterOn = True
  </code></pre>
  <p>The code for EndOfWeek and StartOfWeek is as follow:</p>
  <pre><code>Function StartOfWeek(InDate As Date) As Date
  inWeekday = Weekday(InDate, vbMonday)
  StartOfWeek = InDate - inWeekday + 1
  End Function
  
  Function EndOfWeek(InDate As Date) As Date
  EndOfWeek = StartOfWeek(InDate) + 7
  End Function
  </code></pre>
  <p>The idea is to filter the data based on dates which fall in a specific week ( in the same week and inDate)</p>
  <p>But when I run this, I am getting strange behaviour:</p>
  <p>If InDate is 2/6/2014, then I have records with the following dates:</p>
  <pre><code>12/05/2014
  21/05/2014
  22/05/2014
  23/05/2014
  </code></pre>
  <p>which none of them fell into the week of 2/6/2014 to 9/6/2014</p>
  <p>If I set the inDate to 20/05/2014, I am getting the following records:</p>
  <pre><code>21/05/2014
  22/05/2014
  23/05/2014
  </code></pre>
  <p>Why the filtering doesn't work properly and how can I fix it?</p>
  <h2>Edit1</h2>
  <p>Deleted as it was wrong. Andy answer is correct.</p>