HOW CAN I COUNT THE ROCORS OF MY DATABASE????
Printable View
HOW CAN I COUNT THE ROCORS OF MY DATABASE????
If you are using recordsets, use the .RecordCount property.
Only remember that it will return 0 if there are no records in the recordset, and 1 otherwise.
This is because the .RecordCount property returns the number of records processed, not retrieved. So you can check for existance of records in the recordset by checking if the .RecordCount property is non-zero.
And if you want to do it through SQL, use "Select Count(*) From ...."
Hi Bjorn
Try this :)
Code:Data1.Recordset.MoveLast
numrecs = Data1.Recordset.RecordCount
Data1.Recordset.MoveFirst
msgbox numrecs
Use the Max property with fieldQuote:
Originally posted by Bjorn
HOW CAN I COUNT THE ROCORS OF MY DATABASE????
ex:
select max(bookid) from bookmaster
This select statement will retrieve the Maximum number from the database...
The function MAX will NOT return the number of record in the table, but the highest value of the indicated field. For instance : it is possible MAX(ID) returns 25142, even if there is only 1 record in the table.
Best way is to use SQL "SELECT COUNT(*) FROM..."
Yes U were right IringQuote:
Originally posted by iring
The function MAX will NOT return the number of record in the table, but the highest value of the indicated field. For instance : it is possible MAX(ID) returns 25142, even if there is only 1 record in the table.
Best way is to use SQL "SELECT COUNT(*) FROM..."
Thanks !!!!