How do you count the records in a recordset 
Author Message
 How do you count the records in a recordset

I tried using the rs.count property to return the records in the recordset,
but this does not work.  The code will not compile.  Looked at the Count
property and it does not apply to the recordset.

Thanx.

Greg

The method you are using to open a recordset does not use a cursor (
it is called a "Forward-Only" cursor). Without any cursor, ADO is not
meant to be able to return a proper recordset number.

The best advice I can give is never use the execute method of
connections and command objects to return "SELECT" recordsets. You
have no control over the type of recordset, and there is no advantage,
other than saving a few lines of source code.

Try this:

SET rs = New ADODB.Recordset
Set CursorLocation = adUseServer
rs.Open "select * from partners where partnerid = >4059;", & _
      conn, adOpenKeySet, adLockOptimistic

      Msgbox Rs.Count

I have replaces your "recordset" variable with 'rs'. It is not a good
idea to have variables the same name as object types.

Richard.



Fri, 19 Dec 2003 22:09:01 GMT  
 How do you count the records in a recordset
The correct property name is Recordcount


Fri, 19 Dec 2003 22:37:16 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Adodc - RecordSet - Record Count?

2. Get count of records in any size recordset

3. Help needed counting records in recordset

4. Record count for recordset created by executing an ADO command

5. Record Count of a Recordset

6. count # of records in recordset

7. Unable to get the record count by using the RecordCount Property against the DB2 recordset - ASAP

8. Module-level multiple-record recordset vs temp single-record recordset

9. Module-level multiple-record recordset vs temp single-record recordset

10. Eliminate records of one table based on another table record count

11. Counting records in a record set

12. Record Count in a Record Set

 

 
Powered by phpBB® Forum Software