<p>I am running following <code>PHP</code> code to interact with a MS Access database.</p>

<pre><code>$odbc_con = new COM("ADODB.Connection");
$constr = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" . $db_path . ";";
$odbc_con -&gt; open($constr);

$rs_select = $odbc_con -&gt; execute ("SELECT * FROM Main");
</code></pre>

<p>Using <code>($rs_select -&gt; RecordCount)</code> gives -1 though the query is returning non-zero records.</p>

<p>(a) What can be the reason?
(b) Is there any way out?</p>

<p>I have also tried using <code>count($rs_select -&gt; GetRows())</code>. This satisfies the need but looks inefficient as it will involve copying of all the records into an array first.</p>

Doesn't Access have its own COUNT operator? eg:
```
```
$rs_select = $odbc_con -> execute ("SELECT COUNT(*) FROM Main");
```
```