04 Filter - AndrewMB2/Logic-Architect-for-Excel-VBA GitHub Wiki
Filters an ArrData object where defined criteria are true. Returns True if successful, otherwise False.
Applies to
| TableData | ArrData | RsetData | Xdata | XShared |
|---|---|---|---|---|
| ✓ |
Parameters
| Name | Type | Description |
|---|---|---|
| Criteria | Value, array or ParamArray | Array of criteria or name of user defined function. |
The Filter method filters the data, keeping only the records which match the criteria. Criteria consist of the fields and comparison values to be used (field name and value form adjacent parameters). The value can be preceded by any of =, <, <=, >, >=, <> for different types of comparison. If the value is an array, the field is tested to be any of the values in the array. If the value is Empty, the comparison for this field is ignored.
Where criteria are specified for more than one field, then all the criteria must be met for a record to be kept (AND filter). However it is possible to use Not as the first parameter which reverses the entire comparison set, and this can be used to set up an OR filter (e.g. Not, "Field1", "<>2", "Field2", "<>2" will allow through records where Field1 = 2 or Field2 = 2).
Filter also supports filtering with a user defined function. The name of the user defined function is supplied as the single criteria parameter. For more information on writing user defined functions see Transforming Data.