Name

Recordset.Filter Property — (Versions 2.0, 2.1, 2.5, 2.6)

Synopsis

recordset.CancelBatch AffectRecords

The Filter property filters a selection of records within the current Recordset object.

Datatype

Variant

Description

When you set the Filter property, the cursor type is changed to the current filtered recordset. In this case, the AbsolutePosition, AbsolutePage, RecordCount, and PageCount properties are affected, since the current record is changed to the first record that meets the requirements dictated by the Filter property.

The Filter property can have one of three types of values:

  • A set of clauses that are connected with the AND or OR keywords.

  • An array of bookmark values.

  • A FilterGroupEnum enumeration value.

Clauses are similar to WHERE clauses in SQL statements. They consist of a field name, an operator, and a value. Multiple clauses can be grouped and joined together with the AND and OR keywords. The field name in a clause has to be a valid field name within the current recordset and if it contains spaces, it has to be placed in brackets ([First Name]). The operator within a clause can be any of the following: <, >, <=, >=, <>, =, or LIKE. The value within a clause is similar to the data within the field specified. Numbers can use decimal points, dollar signs, and scientific notation. Dates are surrounded by pound signs (#) (#06/20/1973#) and strings are surrounded by single quotes ('Jason T. Roff').

If you are using the LIKE keyword as an operator, only the asterisk (*) and ...

Get ADO: ActiveX Data Objects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.