title: adodb recordcount returning wrong values
body: <p>I am querying the excel using the below code to get the rows matching a certain condition:</p>
  
  <pre><code>For i = 90 To Worksheets("My Sheet").Range("E65536").End(xlUp).Row
  ' This for loop is to iterate through the list of dates in the excel sheet
  Value = Worksheets("My Sheet").Range("E" &amp; i).Value - #1/1/1900# + 2
  'Using the above line i am converting the date i want to filter the date 
   'into numeric
  strQuery = "SELECT * FROM [My another sheet$A3:I" &amp; LastRow &amp; "] WHERE [Date1]&lt; " &amp;
  Value &amp; " AND ([somefield] = 'dog' or [somefield] = 'cat')"
      ' Here in the SQL query i am trying to see how many cats and dogs are satisfying with my date criteria
      Set rs = New ADODB.Recordset
          With rs
              .ActiveConnection = cn
              .Source = strQuery
              .CursorType = adOpenDynamic
              .CursorLocation = adUseClient
              .LockType = adLockOptimistic
              .Open
          End With
  
  
  ' Executing the select query on excel as database using ADODB api
      If rs.RecordCount = 0 Then        
          Else
              rs.MoveLast        
      End If
   Worksheets("My Sheet").Range("F" &amp; i).Value = rs.RecordCount
   rs.Close
   ' Moving to the next date in the list
  Next
  </code></pre>
  
  <p>I have data something like this</p>
  
  <ol>
  <li>01/01/2012      dog         A</li>
  <li>02/01/2012      cat         B</li>
  <li>03/01/2012      cat         C</li>
  <li>04/01/2012      rat         D</li>
  <li>05/01/2012      cat         E</li>
  <li>06/01/2012      parrot          F</li>
  </ol>
  
  <p>and my list has dates like this</p>
  
  <ol>
  <li>12/31/2010 - Here i have to find how many cats and dogs are
  purchased from the shop with date less than this date</li>
  <li>12/31/2011 - Here i have to find how many cats and dogs are
  purchased from the shop with date less than this date</li>
  </ol>
  
  <p>The purpose of the for loop is to iterate through these dates and modifying the select query
  This are the values i am receiving from the above code </p>
  
  <p><code>32
  35
  37
  44
  57
  64
  71
  78
  84
  86
  89
  91
  91
  </code>
  But i should get these values 
  <code>32
  36
  37
  47
  57
  66
  73
  81
  84
  89
  90
  91
  91
  </code>
  I read somewhere like that we should issue the command <code>rs.movelast</code> before using the record count property but still it is showing wrong result on some iterations..</p>
  
  <p>Is it because of the loop and i am using the same record set.</p>
  
  <p>The reason i know the count should be is because i just did the same filtering on excel columns and it is showing different count</p>
  
  <p>There is no datatype changing in the columns i.e. each column has same data structure from start to end</p>
  
  <p>Please help me on this.</p>
  
  <p>I hope the question is clear..please let me know if more details are needed.</p>