Hi Todd, here is a solution:
Dim rsForCount, cnnExisting
Set rsForCount = Server.CreateObject( "ADODB.Recordset")
' we will use your existing connection
Set cnnExisting = rsYourExistingRecorset.ActiveConnection
rsForCount.CursorLocation = 3 ' adUseClient, to be able to disconnect recorset
rsForCount.Open "Select COUNT(*) As Count From TableName Where WhereClause", cnnExisting
Set rsForCount.ActiveConnection = Nothing ' get a disconnected recordset
myField = rsForCount.Fields( "Count").Value
Set rsForCount = Nothing
The same thing you may use to SUM field values and so on.
With best regards,
Alex
>With fox pro working with tables allows the utilization of a count statement to found out how many of something ='s a certain value. Such as this statment
>
>count for myfield='X' to m.myfield
>
>I am working with ASP currently and connecting to fox pro table using odbc. Is there a way to count a field name = to a certain value like above in my recordset created with ADO? I am going to have several fields that need totaing in my recordset and I would prefer not to use a loop for efficiency purposes.
>
>
>Thanks in advace.
Alex