If you are trying to count the number of records within a recordset but you’re getting back the value -1, then chances are you’re using the wrong cursor type.
In ActiveX Data Objects (ADO) you can only get a valid record count with static and dynamic cursors. Unfortunately, neither of these is the default cursor. Active Server Pages (ASP) doesn’t provide the ADO values. You have to include the correct values for a static or dynamic cursor.The following code shows how to retrieve an accurate record count from an Access database. Notice that the first two lines of code declare the values for the acceptable cursor types.
Many programmers use an include file, adovbs.inc, which provides all of the constants for ADO programming.