title: VBA - Compile Error: Invalid use of property
body: <p>I am trying to count the no of elements in a recordset after a query. I am doing this</p>
  
  <pre><code>Function Test() As Variant
      Dim rst As DAO.Recordset
      rst = CurrentDb.OpenRecordset("SELECT salary_total FROM CompSal")
      rst.MoveLast
      rst.MoveFirst
      Test = rst.RecordCount
  End Function
  </code></pre>
  
  <p>I get this compile error:</p>
  
  <blockquote>
    <p>invalid use of property</p>
  </blockquote>
  
  <p>How to make this work?</p>