Click to See Complete Forum and Search --> : Count record aside from Recordcount


CecileR
August 13th, 2001, 09:04 PM
How can I have record count without using RecordCount function. Is there a way like

Select Count(*) from Tablename

If there is..how can I code this?
starting with

Dim RS As ADODB.Recordset

Set RS = new ADODB.Recordset
RS.Open ....


cecile

The more u read, the more u do not know

d.paulson
August 13th, 2001, 09:44 PM
Dim RS As ADODB.Recordset

Set RS = new ADODB.Recordset
RS.Open "SELECT COUNT(*) as RecordCount FROM TableName",cnYourConnection, adOpenKeyset, adLockOptimistic, adCmdText
debug.print RS!RecordCount
rs.close
set rs = nothing



David Paulson

Strat
August 17th, 2001, 04:47 PM
If you want to use the "select count(*) from Tablename" method, just set a variable to the result like this:

lngCount = RS.Fields(0)