 <p> Hi. Create the query with <code>SQL_CALC_FOUND_ROWS</code> and then get it via <a href="http://dev.mysql.com/doc/refman/5.0/en/information-functions.html#function_found-rows" rel="nofollow"><code>FOUND_ROWS()</code></a> function.<br /> What I mean is this:</p> <pre class="lang-vb prettyprint-override"><code>Set rsPhotoSearch = _ conn_Object.Execute("Select SQL_CALC_FOUND_ROWS * FROM table LIMIT offSet, rowCount") Dim lngTotalRecords lngTotalRecords = conn_Object.Execute("Select Found_Rows();")(0).Value Response.Write "Total Records : "&amp; lngTotalRecords 'Loop starts 'etc </code></pre>