FilterOn Property

Applies To

Form, Report.

Description

You can use the FilterOn property to specify or determine whether the Filter property for a form or report is applied.

Setting

The FilterOn property uses the following arguments.

Setting

Description

Visual Basic

Yes

The object’s Filter property is applied.

True (-1)

No

(Default) The object’s Filter property isn’t applied.

False (0)


For reports, you can set the FilterOn property in the report’s property sheet or using Visual Basic.

For forms, you can set the FilterOn property using a macro or Visual Basic. You can also set this property by clicking the Apply Filter button on the Form view toolbar or the Filter/Sort toolbar.

Remarks

To apply a saved filter, press the Apply Filter button for forms, or apply the filter using a macro or Visual Basic by setting the FilterOn property to True (-1) for forms or reports. For reports, you can set the FilterOn property to Yes in the report’s property sheet.

The Apply Filter button indicates the state of the Filter and FilterOn properties. The button remains disabled until there is a filter to apply. If an existing filter is currently applied, the Apply Filter button appears pressed in. To apply a filter automatically when a form or report is opened, specify in the OnOpen event property setting of the form either a macro that uses the ApplyFilter action or an event procedure that uses the ApplyFilter method of the DoCmd object.

You can remove a filter by clicking the pressed-in Apply Filter button, clicking Remove Filter/Sort on the Records menu, or using Visual Basic to set the FilterOn property to False (0). For reports, you can remove a filter by setting the FilterOn property to No in the report’s property sheet.

Note When a new object is created, it inherits the RecordSource, Filter, OrderBy, and OrderByOn properties of the table or query it was created from. For forms and reports, inherited filters aren’t automatically applied when an object is opened.

See Also

AllowFilters Property, ApplyFilter Action, ApplyFilter Event, ApplyFilter Method, Filter Event, Filter Property, Filter Property (Microsoft Office 95 Data Access Reference), OrderBy Property, OrderByOn Property.