View Full Version : How to count the number of rows in a RecordSet???

03-04-2004, 09:44 AM
HI all, Im now doing a system using ASP.

But right now, Im implementing VBScript to access the database. Im using MS Access.

Ive been having problems trying to get the number of rows of the recordset.

For example, I need to know the number of orders the same person made for a certain month...

So i guess the SQL Statement would be

set rs = Select count(*) from Expenses where id = id and MONTH(date) = 11

How do i get the number of rows in 'rs' ? Can i? If not is there any alternatives to get the row count from the database?

Any help would be appreciated..Thanks

03-04-2004, 10:06 AM
A query like that returns a recordset with one record that has one field (the count).
So I think rs.fields(0).value or rs(0) will work. But if it doesn't, you could always use "as" in the sql statement to give the field a name: select count(*) as num_orders from ..... Then you could definitely use rs("num_orders").


03-04-2004, 10:14 AM
Yea baby...thanks alot...:thumbsup: That is going to be so useful...I was still thinking like mad on how to do it...haa thanks again..