PROBLEM
The recordset class has a count property that is populated internally with the number of records in the recordset. Sometimes this count property contains the value '-1' even when the recordset has records.
Recordsets returned by the SearchExpression method will always have a count value of '-1'. This is a known issue.
The same is true for the SearchShape and SearchByDistance methods if the third argument 'expression' is used with anything other than a null string.
This is a Visual Basic example:
Code:
Set recs = aMapLayer.SearchExpression("AFIELD = 'AVALUE'")
Dim stats As MapObjects2.Statistics
Set stats = recs.CalculateStatistics("FeatureID")
MsgBox "The number of records is: " & stats.Count
Article ID:000004128
Get help from ArcGIS experts
Download the Esri Support App