ADO » DataControl » FilterCriterion

string = datacontrolobject.FilterCriterion
datacontrolobject.FilterCriterion = string

Sets the filter criteria. Does not activate the filter.

The FilterCriterion property sets or returns a string that is the evaluation operator to be used in the string filter. Only the following characters can be used:

Operator Value
< Less than
<= Less than or equal
> Greater than
>= Greater than or equal
= Equal
<> Not equal

The FilterColumn, FilterCriteria, and FilterValue properties are used together to create a string filter that can be applied to the records in a Recordset contained in the client-side cache. To execute the filter, you need to call the Reset method. Based upon the filter, a subset of those records in the Recordset will be returned. Meanwhile, the original Recordset will remain unchanged in the client-side cache.

When you call Reset, if both the filter and sort properties are in effect, the filtering will occur first followed by the sorting.

If you change the value of the FilterCriterion property, you must call the Reset method to put the change into effect.

If you wish to completely clear the filter that is in effect, you need to set the FilterColumn, FilterCriteria, and FilterValue properties to be the empty string and call Reset with a value of False for the parameter.


Dim strFilCol, strFilCrit, strFilVal
strFilCol = "Age"
strFilCrit = ">"
strFilVal = "99"
objDataControl.FilterColumn = strFilCol
objDataControl.FilterCriterion = strFilCrit
objDataControl.FilterValue = strFilVal

See Also: